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.
This commit is contained in:
Raymond Hill 2020-02-01 12:47:17 -05:00
parent e37447779b
commit 1d51927d2e
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -446,6 +446,7 @@ RedirectEngine.prototype.compileRuleFromStaticFilter = function(line) {
.replace(/\*/g, '[\\w.%-]*') .replace(/\*/g, '[\\w.%-]*')
.replace(/\./g, '\\.') + .replace(/\./g, '\\.') +
path path
.replace(/\|$/, '$')
.replace(/[.+?{}()|[\]\/\\]/g, '\\$&') .replace(/[.+?{}()|[\]\/\\]/g, '\\$&')
.replace(/\^/g, '[^\\w.%-]') .replace(/\^/g, '[^\\w.%-]')
.replace(/\*/g, '.*?'); .replace(/\*/g, '.*?');