Skip to content

Commit

Permalink
fix: splitting queries incorrectly removed quotes
Browse files Browse the repository at this point in the history
This made it impossible to use any search queries with quotes in it.

Closes #107
  • Loading branch information
pvcnt committed Sep 6, 2024
1 parent 183f5ec commit cd90f2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/github/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function splitQueries(search: string): string[] {
query = "";
} else if (c === '"') {
quoted = !quoted;
query += c;
} else {
query += c;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/github/tests/search.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ test("split a search string into queries", () => {
expect(splitQueries("a")).toEqual(["a"]);
expect(splitQueries("a;b")).toEqual(["a", "b"]);
expect(splitQueries(" a ; b ")).toEqual(["a", "b"]);
expect(splitQueries('"a;b";c')).toEqual(["a;b", "c"]);
expect(splitQueries(`"a"`)).toEqual([`"a"`]);
expect(splitQueries(`"a;b";c`)).toEqual([`"a;b"`, "c"]);
expect(splitQueries("a; ;c")).toEqual(["a", "c"]);
});

Expand Down

0 comments on commit cd90f2b

Please sign in to comment.