fix: allow underscore as a valid char in tunnel remote address (#190904)

adjust the regexes used to validate tunnel remote addresses, add underscore as a valid char.
This commit is contained in:
floge07 2023-08-21 21:18:44 +02:00 committed by GitHub
parent 548c32e80c
commit d0b14e8569
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -24,7 +24,7 @@
},
{
"type": "string",
"pattern": "^([a-z0-9-]+):(\\d{1,5})$"
"pattern": "^([a-z0-9_-]+):(\\d{1,5})$"
}
]
}

View file

@ -50,7 +50,7 @@ export interface Tunnel {
}
export function parseAddress(address: string): { host: string; port: number } | undefined {
const matches = address.match(/^([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*:)?([0-9]+)$/);
const matches = address.match(/^([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*:)?([0-9]+)$/);
if (!matches) {
return undefined;
}