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

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

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/1212
// Relax the rule: verify that the match is completely before the path part
return (match.index + match[0].length) <=
(url.indexOf(hostname) + hostname.length + 1);
// Verify that the end of the match is anchored to the end of the
// hostname.
const end = match.index + match[0].length -
url.indexOf(hostname) - hostname.length;
return end === 0 || end === 1;
};
/******************************************************************************/