File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/module/connection/create Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,17 @@ const connectionUrlValidator: ValidatorFn = (control: AbstractControl<string>) =
3232} ;
3333
3434const addressValidator : ValidatorFn = ( control : AbstractControl < string > ) => {
35- if ( control . value . startsWith ( `http://` ) || control . value . startsWith ( `https://` ) ) return null ;
36- else return { errorText : `Please specify http:// or https://` } ;
35+ const value = control . value ;
36+ if ( ! value . startsWith ( `http://` ) && ! value . startsWith ( `https://` ) ) {
37+ return { errorText : `Please specify http:// or https://` } ;
38+ }
39+ // Check for port format: http(s)://<address>:<port>
40+ // Match http(s):// followed by address content, then :port (digits)
41+ const portPattern = / ^ h t t p s ? : \/ \/ .+ : \d + / ;
42+ if ( ! portPattern . test ( value ) ) {
43+ return { errorText : `Format: http(s)://<address>:<port>` } ;
44+ }
45+ return null ;
3746}
3847
3948@Component ( {
You can’t perform that action at this time.
0 commit comments