From 19268c064ae8be0b51000f7e7adc0dc67c4a2568 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Fri, 21 Feb 2025 15:13:30 +0100 Subject: [PATCH] Remove trailing slash before appending hash --- src/app/api/send/route.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/api/send/route.ts b/src/app/api/send/route.ts index 42cd89865..9c68c807f 100644 --- a/src/app/api/send/route.ts +++ b/src/app/api/send/route.ts @@ -133,7 +133,7 @@ export async function POST(request: Request) { const base = hostname ? `https://${hostname}` : 'https://localhost'; const currentUrl = new URL(url, base); - let urlPath = currentUrl.pathname + currentUrl.hash; + let urlPath = currentUrl.pathname; const urlQuery = currentUrl.search.substring(1); const urlDomain = currentUrl.hostname.replace(/^www./, ''); @@ -141,6 +141,8 @@ export async function POST(request: Request) { urlPath = urlPath.replace(/(.+)\/$/, '$1'); } + urlPath = urlPath + currentUrl.hash; + let referrerPath: string; let referrerQuery: string; let referrerDomain: string;