MCPcopy Index your code
hub / github.com/coder/coder / retrieveRedirect

Function retrieveRedirect

site/src/utils/redirect.ts:18–23  ·  view source on GitHub ↗
(search: string)

Source from the content-addressed store, hash-verified

16 * @returns the URL to redirect to
17 */
18export 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

Callers 2

redirect.test.tsFile · 0.90
LoginPageFunction · 0.90

Calls 1

getMethod · 0.80

Tested by

no test coverage detected