From bb34a4b83bdae06f2332ffe788b405757073527e Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 27 Dec 2025 09:37:30 -0500 Subject: [PATCH] Unescape unduly escaped `|` in regex-based domain options Related issue: https://github.com/uBlockOrigin/uAssets/issues/31261#issuecomment-3693496669 --- src/js/static-filtering-parser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js index 9993acb6b..18b15fa42 100644 --- a/src/js/static-filtering-parser.js +++ b/src/js/static-filtering-parser.js @@ -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; }