From 7281d73509fd79d753ab5ed791eb5e7e29f70911 Mon Sep 17 00:00:00 2001 From: Regalijan Date: Wed, 25 Oct 2023 13:48:34 -0400 Subject: [PATCH] Include search string in return path --- functions/api/auth/oauth.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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")