fix bad regex: all URLs were seen as needing punycoding

This commit is contained in:
gorhill 2017-09-13 13:08:31 -04:00
parent 5626b5005a
commit 04a41d8b22
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 2 additions and 5 deletions

View File

@ -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,