Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Added decoding to URL elements.

Mike Cao833de1a1af2e
diff --git a/src/app/api/send/route.ts b/src/app/api/send/route.ts
index 8519a73e1..bd255eaf8 100644
--- a/src/app/api/send/route.ts
+++ b/src/app/api/send/route.ts
@@ -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({
@@ -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,