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.

fix: handle unknown location fields in user detection

Exlaso0736289ce15b
diff --git a/src/lib/detect.ts b/src/lib/detect.ts
index 4331a9a97..8712632ae 100644
--- a/src/lib/detect.ts
+++ b/src/lib/detect.ts
@@ -146,9 +146,9 @@ export async function getClientInfo(request: Request, payload: Record<string, an
const userAgent = payload?.userAgent || request.headers.get('user-agent');
const ip = payload?.ip || getIpAddress(request.headers);
const location = await getLocation(ip, request.headers, !!payload?.ip);
- const country = decodeURIComponent(location?.country);
- const region = decodeURIComponent(location?.region);
- const city = decodeURIComponent(location?.city);
+ const country = decodeURIComponent(location?.country || 'UNKNOWN');
+ const region = decodeURIComponent(location?.region || 'UNKNOWN');
+ const city = decodeURIComponent(location?.city || 'UNKNOWN');
const browser = browserName(userAgent);
const os = detectOS(userAgent) as string;
const device = getDevice(payload?.screen, os);