Skip to content

Commit 833de1a

Browse files
committed
Added decoding to URL elements.
1 parent 1b21f26 commit 833de1a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/app/api/send/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { createToken, parseToken } from '@/lib/jwt';
1010
import { secret, uuid, hash } from '@/lib/crypto';
1111
import { COLLECTION_TYPE } from '@/lib/constants';
1212
import { anyObjectParam, urlOrPathParam } from '@/lib/schema';
13+
import { safeDecodeURI, safeDecodeURIComponent } from '@/lib/url';
1314
import { createSession, saveEvent, saveSessionData } from '@/queries';
1415

1516
const schema = z.object({
@@ -168,12 +169,12 @@ export async function POST(request: Request) {
168169
websiteId,
169170
sessionId,
170171
visitId,
171-
urlPath,
172+
urlPath: safeDecodeURI(urlPath),
172173
urlQuery,
173-
referrerPath,
174+
referrerPath: safeDecodeURI(referrerPath),
174175
referrerQuery,
175176
referrerDomain,
176-
pageTitle: title,
177+
pageTitle: safeDecodeURIComponent(title),
177178
eventName: name,
178179
eventData: data,
179180
hostname: hostname || urlDomain,

0 commit comments

Comments
 (0)