Skip to content

Commit 6c6555d

Browse files
authored
Merge pull request umami-software#3445 from Nambers/master
fix: URL hash is not included in record
2 parents 65f3628 + 33110a4 commit 6c6555d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/app/api/send/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export async function POST(request: Request) {
145145
const base = hostname ? `https://${hostname}` : 'https://localhost';
146146
const currentUrl = new URL(url, base);
147147

148-
let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname;
148+
let urlPath = currentUrl.pathname === '/undefined' ? '' : currentUrl.pathname + currentUrl.hash;
149149
const urlQuery = currentUrl.search.substring(1);
150150
const urlDomain = currentUrl.hostname.replace(/^www./, '');
151151

@@ -169,7 +169,7 @@ export async function POST(request: Request) {
169169
const twclid = currentUrl.searchParams.get('twclid');
170170

171171
if (process.env.REMOVE_TRAILING_SLASH) {
172-
urlPath = urlPath.replace(/(.+)\/$/, '$1');
172+
urlPath = urlPath.replace(/\/(?=(#.*)?$)/, '');
173173
}
174174

175175
if (referrer) {

0 commit comments

Comments
 (0)