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

Function getRedirectNextPath

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

Source from the content-addressed store, hash-verified

166};
167
168export const getRedirectNextPath = (params: URLSearchParams): string => {
169 const next = params.get('next');
170
171 let nextPath = '/';
172
173 if (next) {
174 try {
175 const nextUrl = new URL(next, 'http://localhost');
176 // infinite redirect loop prevention
177 nextUrl.searchParams.delete('next');
178
179 // we ignore url origin since we don't allow cross-origin redirects
180 nextPath = getPathnameWithQuery(nextUrl.pathname, nextUrl.searchParams);
181 } catch (error) {
182 // eslint-disable-next-line no-console
183 console.error(error);
184 }
185 }
186
187 return checkIsExtension() ? `${webappUrl}${nextPath}` : nextPath;
188};

Callers 2

CoresPaymentPageFunction · 0.90
CoresPageFunction · 0.90

Calls 3

checkIsExtensionFunction · 0.90
getPathnameWithQueryFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected