MCPcopy Create free account
hub / github.com/dailydotdev/apps / getRedirectNextPath

Function getRedirectNextPath

packages/shared/src/lib/links.ts:145–165  ·  view source on GitHub ↗
(params: URLSearchParams)

Source from the content-addressed store, hash-verified

143};
144
145export const getRedirectNextPath = (params: URLSearchParams): string => {
146 const next = params.get('next');
147
148 let nextPath = '/';
149
150 if (next) {
151 try {
152 const nextUrl = new URL(next, 'http://localhost');
153 // infinite redirect loop prevention
154 nextUrl.searchParams.delete('next');
155
156 // we ignore url origin since we don't allow cross-origin redirects
157 nextPath = getPathnameWithQuery(nextUrl.pathname, nextUrl.searchParams);
158 } catch (error) {
159 // eslint-disable-next-line no-console
160 console.error(error);
161 }
162 }
163
164 return checkIsExtension() ? `${webappUrl}${nextPath}` : nextPath;
165};

Callers 2

CoresPaymentPageFunction · 0.90
CoresPageFunction · 0.90

Calls 2

checkIsExtensionFunction · 0.90
getPathnameWithQueryFunction · 0.85

Tested by

no test coverage detected