Remove trailing slash before appending hash

This commit is contained in:
Andreas Hocevar 2025-02-21 15:13:30 +01:00
parent 534bbb5b62
commit 19268c064a
No known key found for this signature in database
GPG key ID: F7FA44133EB59BCD

View file

@ -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;