Skip to content

Commit

Permalink
Handle more special characters in parseSearchFragment (#4521)
Browse files Browse the repository at this point in the history
Some old filters with spaces and | characters broke
  • Loading branch information
macobo authored Sep 3, 2024
1 parent acefd79 commit 3eee780
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion assets/js/dashboard/util/url-search-params.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ describe(`${parseSearchFragment.name}`, () => {
// Non-JSON strings that should return as string
['undefined', 'undefined'],
['not_json', 'not_json'],
['plainstring', 'plainstring']
['plainstring', 'plainstring'],
['a|b', 'a|b'],
['foo bar#', 'foo bar#']
])(
'when searchStringFragment is %p, returns %p',
(searchStringFragment, expected) => {
Expand Down
3 changes: 3 additions & 0 deletions assets/js/dashboard/util/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ export function parseSearchFragment(
/* @ts-expect-error API supposedly not present in compilation target */
.replaceAll('=', encodeURIComponent('='))
.replaceAll('#', encodeURIComponent('#'))
.replaceAll('|', encodeURIComponent('|'))
.replaceAll(' ', encodeURIComponent(' '))

try {
return JsonURL.parse(fragmentWithReEncodedSymbols)
} catch (error) {
Expand Down

0 comments on commit 3eee780

Please sign in to comment.