mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Unescape unduly escaped | in regex-based domain options
Related issue: https://github.com/uBlockOrigin/uAssets/issues/31261#issuecomment-3693496669
This commit is contained in:
parent
6f8edc3ac6
commit
bb34a4b83b
1 changed files with 4 additions and 1 deletions
|
|
@ -2239,7 +2239,10 @@ export class AstFilterParser {
|
||||||
const regex = before.startsWith('[$domain=/')
|
const regex = before.startsWith('[$domain=/')
|
||||||
? `${before.slice(9, -1)}`
|
? `${before.slice(9, -1)}`
|
||||||
: before;
|
: before;
|
||||||
const source = this.normalizeRegexPattern(regex);
|
// TODO: Remove unescaping of `|` once AdGuard filters no longer unduly
|
||||||
|
// escape. In the mean time, if a literal `|` is needed in a path-based
|
||||||
|
// regex, the solution is to use `\x7C` instead of `|`.
|
||||||
|
const source = this.normalizeRegexPattern(regex.replace(/\\\|/g, '|'));
|
||||||
if ( source === '' ) { return ''; }
|
if ( source === '' ) { return ''; }
|
||||||
const after = `/${source}/`;
|
const after = `/${source}/`;
|
||||||
if ( after === before ) { return; }
|
if ( after === before ) { return; }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue