From f806438de6f0106d15bd559d5d30e1cd5a7da324 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 8 Sep 2022 19:37:24 -0400 Subject: [PATCH] Unescaped escaped commas in regex-based removeparam values Related discussion: - https://github.com/uBlockOrigin/uAssets/discussions/14683#discussioncomment-3559284 --- src/js/static-net-filtering.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 1a97ffd99..5df4fe53f 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -3427,6 +3427,8 @@ class FilterCompiler { } } + // https://github.com/uBlockOrigin/uAssets/discussions/14683#discussioncomment-3559284 + // If the removeparam value is a regex, unescape escaped commas extractTokenFromQuerypruneValue() { const pattern = this.modifyValue; if ( pattern === '*' || pattern.charCodeAt(0) === 0x7E /* '~' */ ) { @@ -3434,7 +3436,9 @@ class FilterCompiler { } const match = /^\/(.+)\/i?$/.exec(pattern); if ( match !== null ) { - return this.extractTokenFromRegex(match[1]); + return this.extractTokenFromRegex( + match[1].replace(/(\{\d*)\\,/, '$1,') + ); } if ( pattern.startsWith('|') ) { return this.extractTokenFromRegex('\\b' + pattern.slice(1));