Skip to content

Commit

Permalink
Can't have whitespace in network filter pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Jun 15, 2023
1 parent d590390 commit e5bd755
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/js/static-filtering-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e5bd755

Please sign in to comment.