🌐 AI搜索 & 代理 主页
Skip to content

Commit bb34a4b

Browse files
committed
Unescape unduly escaped | in regex-based domain options
Related issue: uBlockOrigin/uAssets#31261 (comment)
1 parent 6f8edc3 commit bb34a4b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/js/static-filtering-parser.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,10 @@ export class AstFilterParser {
22392239
const regex = before.startsWith('[$domain=/')
22402240
? `${before.slice(9, -1)}`
22412241
: before;
2242-
const source = this.normalizeRegexPattern(regex);
2242+
// TODO: Remove unescaping of `|` once AdGuard filters no longer unduly
2243+
// escape. In the mean time, if a literal `|` is needed in a path-based
2244+
// regex, the solution is to use `\x7C` instead of `|`.
2245+
const source = this.normalizeRegexPattern(regex.replace(/\\\|/g, '|'));
22432246
if ( source === '' ) { return ''; }
22442247
const after = `/${source}/`;
22452248
if ( after === before ) { return; }

0 commit comments

Comments
 (0)