Skip to content

Commit

Permalink
Ensure uri components are decoded
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 committed Jun 12, 2024
1 parent 2d4d158 commit efdb7ce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion web/src/hooks/use-overlay-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,15 @@ export function useSearchEffect(

const params = location.search.substring(1).split("&");

return params
const foundParam = params
.find((p) => p.includes("=") && p.split("=")[0] == key)
?.split("=");

if (foundParam && foundParam.length === 2) {
return [foundParam[0], decodeURIComponent(foundParam[1])];
}

return undefined;
}, [location, key]);

useEffect(() => {
Expand Down

0 comments on commit efdb7ce

Please sign in to comment.