Skip to content

Commit 4afb185

Browse files
committed
Fix bug in filter descriptions for partial not() filter inputs
Previously this incorrectly trimmed the suggestion text before generating the description, which didn't work for partial inputs, and so the description was often returned in a simplified incomplete format.
1 parent e0d14f6 commit 4afb185

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/model/filters/search-filters.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,10 @@ class NotFilter extends Filter {
13891389
static filterName = "not";
13901390

13911391
static filterDescription(value: string, isTemplate: boolean) {
1392-
const innerValue = value.slice(4, -1);
1392+
const hasFinalBracket = value[value.length - 1] === ')';
1393+
const innerValue = hasFinalBracket
1394+
? value.slice(4, -1)
1395+
: value.slice(4);
13931396

13941397
if (innerValue.length === 0) {
13951398
return "exchanges that do not match a given condition"

test/unit/model/filters/search-filter-integration.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,6 +1582,7 @@ describe("Search filter model integration test:", () => {
15821582
["not(error", "excluding requests that weren't transmitted successfully"],
15831583
["not(head", "excluding exchanges by all header values"],
15841584
["not(query^=?abc)", "excluding requests with a query string starting with ?abc"],
1585+
["not(hostname*=", "excluding requests to a hostname containing a given value"],
15851586
["not(method=POST)", "excluding POST requests"]
15861587
].forEach(([input, expectedOutput]) => {
15871588
const description = getSuggestionDescriptions(input)[0];

0 commit comments

Comments
 (0)