Fix: wrong usage of URL.protocol

This commit is contained in:
John Livingston 2023-04-21 16:33:17 +02:00
parent 732138e745
commit b85a1dc90a
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC

View File

@ -57,11 +57,11 @@ function _validUrl (s: string, constraints: URLConstraints): boolean {
if (constraints.protocol) {
if (constraints.protocol === 'http.') {
if (url.protocol !== 'https' && url.protocol !== 'http') {
if (url.protocol !== 'https:' && url.protocol !== 'http:') {
return false
}
} else if (constraints.protocol === 'ws.') {
if (url.protocol !== 'wss' && url.protocol !== 'ws') {
if (url.protocol !== 'wss:' && url.protocol !== 'ws:') {
return false
}
}