1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-02 09:09:38 +02:00

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

View File

@ -93,16 +93,13 @@ vAPI.net.registerListeners = function() {
}; };
var punycode = self.punycode; var punycode = self.punycode;
var reMustNormalizeHostname = /[^0-9a-z._-]/; var reAsciiHostname = /^https?:\/\/[0-9a-z_.:@-]+[/?#]/;
var parsedURL = new URL('about:blank'); var parsedURL = new URL('about:blank');
var normalizeRequestDetails = function(details) { var normalizeRequestDetails = function(details) {
details.tabId = details.tabId.toString(); details.tabId = details.tabId.toString();
if ( if ( mustPunycode && !reAsciiHostname.test(details.url) ) {
mustPunycode === true &&
reMustNormalizeHostname.test(details.url) === true
) {
parsedURL.href = details.url; parsedURL.href = details.url;
details.url = details.url.replace( details.url = details.url.replace(
parsedURL.hostname, parsedURL.hostname,