Skip to content

Commit 5b733b4

Browse files
authored
Merge pull request #19 from RonasIT/PRD-2114-api-url-input-trailing-slash-fix
PRD-2114: Allow trailing slash in api url on sign in screen
2 parents 649a392 + 78881a8 commit 5b733b4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • libs/mobile/auth/features/email-sign-in-form/src/lib/forms

libs/mobile/auth/features/email-sign-in-form/src/lib/forms/email-form.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ export class EmailFormSchema {
2121
.url(i18n.t('SHARED.VALIDATION.TEXT_INVALID_URL'))
2222
.test('no-path', i18n.t('SHARED.VALIDATION.TEXT_INVALID_URL'), (value) => {
2323
if (!value) return true;
24-
if (value.endsWith('/')) return false;
2524

2625
try {
27-
const url = new URL(value);
26+
const normalizedValue = value.trim();
27+
const url = new URL(normalizedValue);
28+
const normalizedPath = url.pathname.replace(/\/+$/, '/');
2829

29-
return url.pathname === '/' && !url.search && !url.hash;
30+
return normalizedPath === '/' && !url.search && !url.hash;
3031
} catch {
3132
return false;
3233
}

0 commit comments

Comments
 (0)