From a95ef16e064a4012de6aef10100daaef6beeb2c2 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 2 Feb 2020 10:05:15 -0500 Subject: [PATCH] Fix token position value when removing leading wildcard Related issue: - https://www.reddit.com/r/uBlockOrigin/comments/ex8ggg/ Regression from: - https://github.com/gorhill/uBlock/commit/7971b223855d --- src/js/static-net-filtering.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 36174a383..f5c42bfd9 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -2531,10 +2531,13 @@ const FilterParser = class { // https://www.reddit.com/r/uBlockOrigin/comments/dpcvfx/ // Since we found a valid token, we can get rid of leading/trailing // wildcards if any. + // https://github.com/gorhill/uBlock/commit/7971b223855d#commitcomment-37077525 + // Mind that changing the pattern may change token start index. if ( this.firstWildcardPos === 0 ) { this.f = this.f.slice(1); this.firstWildcardPos = this.secondWildcardPos; this.secondWildcardPos = -1; + this.tokenBeg -= 1; } if ( this.firstWildcardPos !== -1 ) { const lastCharPos = this.f.length - 1;