Fix encoding in global search (#2116)

Using plus symbol in global search led to a space in the query parameter of the URL. We now encode the query string properly in global search and additionally fixed the expert search documentation.
This commit is contained in:
Matthias Thieroff
2022-09-14 08:05:31 +02:00
committed by GitHub
parent 30e26b8d4e
commit 54b7b96ac8
6 changed files with 35 additions and 60 deletions

View File

@@ -98,6 +98,16 @@ describe("tests for getQueryStringFromLocation", () => {
expect(getQueryStringFromLocation(location)).toBe("abc");
});
it("should return the query string with a space instead of a plus symbol", () => {
const location = createLocation("?q=+(Test)");
expect(getQueryStringFromLocation(location)).toBe(" (Test)");
});
it("should return the query string with a plus symbol", () => {
const location = createLocation("?q=%2B(Test)");
expect(getQueryStringFromLocation(location)).toBe("+(Test)");
});
it("should return query string from multiple parameters", () => {
const location = createLocation("?x=a&y=b&q=abc&z=c");
expect(getQueryStringFromLocation(location)).toBe("abc");