The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord

fix: preserve original path and query in login callback

Ensure the callback uses the full request path and query from the URL,
retaining all parameters instead of reconstructing it from pieces.

shi.gg 04c2c8c5 ba79bc31

verified
+2 -2
+2 -2
app/login/[social]/route.ts
··· 20 20 } 21 21 22 22 const verifier = `login-code-verifier-${social}`; 23 - const { searchParams } = new URL(request.url); 23 + const { searchParams, host } = new URL(request.url); 24 24 const jar = await cookies(); 25 25 26 26 const logout = searchParams.get("logout"); 27 27 const session = jar.get("session"); 28 28 29 29 if (!session?.value) { 30 - redirect("/login?callback=" + encodeURIComponent(`/login/${social}${logout === "true" ? "?logout=true" : ""}`)); 30 + redirect("/login?callback=" + encodeURIComponent(request.url.split(host)[1])); 31 31 } 32 32 33 33 if (logout) {