Skip to content

Commit

Permalink
fix bad regex: all URLs were seen as needing punycoding
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Sep 13, 2017
1 parent 5626b50 commit 04a41d8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions platform/webext/vapi-webrequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 04a41d8

Please sign in to comment.