mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Fine tune network filter option anchor detection
The change allows to better parse AdGuard filters with `replace=` option when the value to the `replace=` option contains dollar sign character `$`. uBO will still reject these filters but will better identify which dollar sign `$` is the real filter option anchor.
This commit is contained in:
parent
622cda2cdf
commit
e52da39839
1 changed files with 11 additions and 3 deletions
|
|
@ -1387,9 +1387,17 @@ export class AstFilterParser {
|
|||
if ( j === -1 ) { return end; }
|
||||
if ( (j+1) === end ) { return end; }
|
||||
for (;;) {
|
||||
if ( j !== start && s.charCodeAt(j-1) === 0x24 /* $ */ ) { return -1; }
|
||||
const c = s.charCodeAt(j+1);
|
||||
if ( c !== 0x29 /* ) */ && c !== 0x2F /* / */ && c !== 0x7C /* | */ ) { return j; }
|
||||
const before = s.charCodeAt(j-1);
|
||||
if ( j !== start && before === 0x24 /* $ */ ) { return -1; }
|
||||
const after = s.charCodeAt(j+1);
|
||||
if (
|
||||
after !== 0x29 /* ) */ &&
|
||||
after !== 0x2F /* / */ &&
|
||||
after !== 0x7C /* | */ &&
|
||||
before !== 0x5C /* \ */
|
||||
) {
|
||||
return j;
|
||||
}
|
||||
if ( j <= start ) { break; }
|
||||
j = s.lastIndexOf('$', j-1);
|
||||
if ( j === -1 ) { break; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue