From 1d51927d2efe9c7789ecc12ef84e2204354f9f62 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 1 Feb 2020 12:47:17 -0500 Subject: [PATCH] Fix handling of end-anchor in redirect patterns Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/872 An end-anchor was treated as literal `|` in the redirect pattern to match instead of as a end-of-string condition. --- src/js/redirect-engine.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index 4662ae2da..71bf016de 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -446,6 +446,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) { .replace(/\*/g, '[\\w.%-]*') .replace(/\./g, '\\.') + path + .replace(/\|$/, '$') .replace(/[.+?{}()|[\]\/\\]/g, '\\$&') .replace(/\^/g, '[^\\w.%-]') .replace(/\*/g, '.*?');