diff --git a/src/js/proxified-containers.js b/src/js/proxified-containers.js index 3fdcf30..d8c7910 100644 --- a/src/js/proxified-containers.js +++ b/src/js/proxified-containers.js @@ -93,13 +93,13 @@ proxifiedContainers = { }, - //Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional) + // Parses a proxy description string of the format type://host[:port] or type://username:password@host[:port] (port is optional) parseProxy(proxy_str, mozillaVpnData = null) { - const proxyRegexp = /(?(https?)|(socks4?)):\/\/(\b(?\w+):(?\w+)@)?(?((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)(\.([\w.-]+))+))(:(?\d+))?/; - if (proxyRegexp.test(proxy_str) !== true) { + const proxyRegexp = /(?(https?)|(socks4?)):\/\/(\b(?\w+):(?\w+)@)?(?((?:\d{1,3}\.){3}\d{1,3}\b)|(\b([\w.-]+)+))(:(?\d+))?/; + const matches = proxyRegexp.exec(proxy_str); + if (!matches) { return false; } - const matches = proxyRegexp.exec(proxy_str); if (mozillaVpnData && mozillaVpnData.mozProxyEnabled === undefined) { matches.groups.type = "direct";