(search: string)
| 16 | * @returns the URL to redirect to |
| 17 | */ |
| 18 | export const retrieveRedirect = (search: string): string => { |
| 19 | const defaultRedirect = "/"; |
| 20 | const searchParams = new URLSearchParams(search); |
| 21 | const redirect = searchParams.get("redirect"); |
| 22 | return redirect ? redirect : defaultRedirect; |
| 23 | }; |
| 24 | |
| 25 | /** |
| 26 | * Ensures the redirect is not an open redirect, aka it's relative |
no test coverage detected