From e5bd7556d912a520370dba6a91e03555347d8437 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 15 Jun 2023 09:12:06 -0400 Subject: [PATCH] Can't have whitespace in network filter pattern Related feedback: - https://github.com/uBlockOrigin/uAssets/discussions/17538#discussioncomment-6137462 --- src/js/static-filtering-parser.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js index 28322bb81..ac9f50738 100644 --- a/src/js/static-filtering-parser.js +++ b/src/js/static-filtering-parser.js @@ -1638,12 +1638,14 @@ export class AstFilterParser { pattern = pattern.slice(0, -ignoreLen); } + const patternHasWhitespace = this.hasWhitespace && + this.reHasWhitespaceChar.test(pattern); const needNormalization = this.needPatternNormalization(pattern); const normal = needNormalization ? this.normalizePattern(pattern) : pattern; next = this.allocTypedNode(NODE_TYPE_NET_PATTERN, patternBeg, patternEnd); - if ( normal === undefined ) { + if ( patternHasWhitespace || normal === undefined ) { this.astTypeFlavor = AST_TYPE_NETWORK_PATTERN_BAD; this.addFlags(AST_FLAG_HAS_ERROR); this.astError = AST_ERROR_PATTERN;