From 41636c59fb4208544b4bb23a5ac6273399cab625 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 2 Jul 2019 11:56:27 -0400 Subject: [PATCH] Strict-block only if match is anchored to end of hostname As per feedback from filter list maintainers. --- src/js/traffic.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/js/traffic.js b/src/js/traffic.js index 1df0bdaaf..96b5ad6f4 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -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; }; /******************************************************************************/