From 04a41d8b22276c5177c14337ac2d8fe7d781140c Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 13 Sep 2017 13:08:31 -0400 Subject: [PATCH] fix bad regex: all URLs were seen as needing punycoding --- platform/webext/vapi-webrequest.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/platform/webext/vapi-webrequest.js b/platform/webext/vapi-webrequest.js index 7945bd485..2bb53e980 100644 --- a/platform/webext/vapi-webrequest.js +++ b/platform/webext/vapi-webrequest.js @@ -93,16 +93,13 @@ vAPI.net.registerListeners = function() { }; var punycode = self.punycode; - var reMustNormalizeHostname = /[^0-9a-z._-]/; + var reAsciiHostname = /^https?:\/\/[0-9a-z_.:@-]+[/?#]/; var parsedURL = new URL('about:blank'); var normalizeRequestDetails = function(details) { details.tabId = details.tabId.toString(); - if ( - mustPunycode === true && - reMustNormalizeHostname.test(details.url) === true - ) { + if ( mustPunycode && !reAsciiHostname.test(details.url) ) { parsedURL.href = details.url; details.url = details.url.replace( parsedURL.hostname,