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

Function getRedirectNextPath

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

Source from the content-addressed store, hash-verified

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

Callers 2

CoresPaymentPageFunction · 0.90
CoresPageFunction · 0.90

Calls 2

checkIsExtensionFunction · 0.90
getPathnameWithQueryFunction · 0.85

Tested by

no test coverage detected