Unescape unduly escaped | in regex-based domain options

Related issue:
https://github.com/uBlockOrigin/uAssets/issues/31261#issuecomment-3693496669
This commit is contained in:
Raymond Hill 2025-12-27 09:37:30 -05:00
parent 6f8edc3ac6
commit bb34a4b83b
No known key found for this signature in database
GPG key ID: F5630CAE62A14316

View file

@ -2239,7 +2239,10 @@ export class AstFilterParser {
const regex = before.startsWith('[$domain=/')
? `${before.slice(9, -1)}`
: 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 ''; }
const after = `/${source}/`;
if ( after === before ) { return; }