Ensure uri components are decoded (#11920)

This commit is contained in:
Josh Hawkins 2024-06-12 16:03:00 -05:00 committed by GitHub
parent 2d4d1584fd
commit 187d98a153
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -109,9 +109,15 @@ export function useSearchEffect(
const params = location.search.substring(1).split("&"); const params = location.search.substring(1).split("&");
return params const foundParam = params
.find((p) => p.includes("=") && p.split("=")[0] == key) .find((p) => p.includes("=") && p.split("=")[0] == key)
?.split("="); ?.split("=");
if (foundParam && foundParam.length === 2) {
return [foundParam[0], decodeURIComponent(foundParam[1])];
}
return undefined;
}, [location, key]); }, [location, key]);
useEffect(() => { useEffect(() => {