Skip to content

Commit

Permalink
Added decoding to URL elements.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecao committed Mar 8, 2025
1 parent 1b21f26 commit 833de1a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/api/send/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { createToken, parseToken } from '@/lib/jwt';
import { secret, uuid, hash } from '@/lib/crypto';
import { COLLECTION_TYPE } from '@/lib/constants';
import { anyObjectParam, urlOrPathParam } from '@/lib/schema';
import { safeDecodeURI, safeDecodeURIComponent } from '@/lib/url';
import { createSession, saveEvent, saveSessionData } from '@/queries';

const schema = z.object({
Expand Down Expand Up @@ -168,12 +169,12 @@ export async function POST(request: Request) {
websiteId,
sessionId,
visitId,
urlPath,
urlPath: safeDecodeURI(urlPath),
urlQuery,
referrerPath,
referrerPath: safeDecodeURI(referrerPath),
referrerQuery,
referrerDomain,
pageTitle: title,
pageTitle: safeDecodeURIComponent(title),
eventName: name,
eventData: data,
hostname: hostname || urlDomain,
Expand Down

0 comments on commit 833de1a

Please sign in to comment.