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: decode location fields in user detection

Exlasoebdd9095ab13
diff --git a/src/lib/detect.ts b/src/lib/detect.ts
index a023d27d2..4331a9a97 100644
--- a/src/lib/detect.ts
+++ b/src/lib/detect.ts
@@ -5,11 +5,11 @@ import ipaddr from 'ipaddr.js';
import maxmind from 'maxmind';
import {
DESKTOP_OS,
- MOBILE_OS,
DESKTOP_SCREEN_WIDTH,
+ IP_ADDRESS_HEADERS,
LAPTOP_SCREEN_WIDTH,
+ MOBILE_OS,
MOBILE_SCREEN_WIDTH,
- IP_ADDRESS_HEADERS,
} from './constants';
const MAXMIND = 'maxmind';
@@ -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 = location?.country;
- const region = location?.region;
- const city = location?.city;
+ const country = decodeURIComponent(location?.country);
+ const region = decodeURIComponent(location?.region);
+ const city = decodeURIComponent(location?.city);
const browser = browserName(userAgent);
const os = detectOS(userAgent) as string;
const device = getDevice(payload?.screen, os);