From 2f735fa5927fd018006131ab3eb4e27c51cd35ee Mon Sep 17 00:00:00 2001 From: joshua Date: Tue, 25 Nov 2025 13:55:32 -0500 Subject: [PATCH] Add port validation --- .../create/connection-creator.component.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/module/connection/create/connection-creator.component.ts b/src/module/connection/create/connection-creator.component.ts index 32425f87..c2a87b93 100644 --- a/src/module/connection/create/connection-creator.component.ts +++ b/src/module/connection/create/connection-creator.component.ts @@ -32,8 +32,17 @@ const connectionUrlValidator: ValidatorFn = (control: AbstractControl) = }; const addressValidator: ValidatorFn = (control: AbstractControl) => { - if (control.value.startsWith(`http://`) || control.value.startsWith(`https://`)) return null; - else return { errorText: `Please specify http:// or https://` }; + const value = control.value; + if (!value.startsWith(`http://`) && !value.startsWith(`https://`)) { + return { errorText: `Please specify http:// or https://` }; + } + // Check for port format: http(s)://
: + // Match http(s):// followed by address content, then :port (digits) + const portPattern = /^https?:\/\/.+:\d+/; + if (!portPattern.test(value)) { + return { errorText: `Format: http(s)://
:` }; + } + return null; } @Component({