mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
Improve dealing with ambiguity in regex-based-looking network filters
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1932 Reported in point 3 under "Actual behavior".
This commit is contained in:
parent
a5ca565e9c
commit
f98b70d1c0
1 changed files with 7 additions and 0 deletions
|
@ -416,6 +416,13 @@ const Parser = class {
|
||||||
len === 3 && this.slices[i+2] > 2 ||
|
len === 3 && this.slices[i+2] > 2 ||
|
||||||
len > 3 && hasBits(this.slices[i+len-3], BITSlash)
|
len > 3 && hasBits(this.slices[i+len-3], BITSlash)
|
||||||
);
|
);
|
||||||
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/1932
|
||||||
|
// Resolve ambiguity with options ending with `/` by verifying
|
||||||
|
// that when a `$` is present, what follows make sense regex-wise.
|
||||||
|
if ( patternIsRegex && hasBits(this.allBits, BITDollar) ) {
|
||||||
|
patternIsRegex =
|
||||||
|
this.strFromSpan(this.patternSpan).search(/[^\\]\$[^/|)]/) === -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the pattern is not a regex, there might be options.
|
// If the pattern is not a regex, there might be options.
|
||||||
|
|
Loading…
Reference in a new issue