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

Function getRedirectNextPath

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

Source from the content-addressed store, hash-verified

196};
197
198export const getRedirectNextPath = (params: URLSearchParams): string => {
199 const next = params.get('next');
200
201 let nextPath = '/';
202
203 if (next) {
204 try {
205 const nextUrl = new URL(next, 'http://localhost');
206 // infinite redirect loop prevention
207 nextUrl.searchParams.delete('next');
208
209 // we ignore url origin since we don't allow cross-origin redirects
210 nextPath = getPathnameWithQuery(nextUrl.pathname, nextUrl.searchParams);
211 } catch (error) {
212 // eslint-disable-next-line no-console
213 console.error(error);
214 }
215 }
216
217 return checkIsExtension() ? `${webappUrl}${nextPath}` : nextPath;
218};
219
220// Extension routes don't exist on the webapp, so `next` is dropped there.
221export const getBuyCoresUrl = ({

Callers 2

CoresPaymentPageFunction · 0.90
CoresPageFunction · 0.90

Calls 2

checkIsExtensionFunction · 0.90
getPathnameWithQueryFunction · 0.85

Tested by

no test coverage detected