Strict-block only if match is anchored to end of hostname

As per feedback from filter list maintainers.
This commit is contained in:
Raymond Hill 2019-07-02 11:56:27 -04:00
parent 9d198a2710
commit 41636c59fb
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 5 additions and 3 deletions

View File

@ -246,9 +246,11 @@ const toBlockDocResult = function(url, hostname, logData) {
// https://github.com/chrisaljoudi/uBlock/issues/1128 // https://github.com/chrisaljoudi/uBlock/issues/1128
// https://github.com/chrisaljoudi/uBlock/issues/1212 // https://github.com/chrisaljoudi/uBlock/issues/1212
// Relax the rule: verify that the match is completely before the path part // Verify that the end of the match is anchored to the end of the
return (match.index + match[0].length) <= // hostname.
(url.indexOf(hostname) + hostname.length + 1); const end = match.index + match[0].length -
url.indexOf(hostname) - hostname.length;
return end === 0 || end === 1;
}; };
/******************************************************************************/ /******************************************************************************/