mirror of https://github.com/gorhill/uBlock.git
Strict-block only if match is anchored to end of hostname
As per feedback from filter list maintainers.
This commit is contained in:
parent
9d198a2710
commit
41636c59fb
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue