diff --git a/functions/api/auth/oauth.ts b/functions/api/auth/oauth.ts index 9029cc2..ca2d8b3 100644 --- a/functions/api/auth/oauth.ts +++ b/functions/api/auth/oauth.ts @@ -4,8 +4,10 @@ export async function onRequestGet(context: RequestContext) { let returnPath = "/"; const referer = request.headers.get("referer"); - if (referer) returnPath = new URL(referer).pathname; - else { + if (referer) { + const { pathname, search } = new URL(referer); + returnPath = `${pathname}${search}`; + } else { const { searchParams } = new URL(context.request.url); if (searchParams.get("type") === "mobile")