mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
fix: use safeDecodeURIComponent for location fields in user detection
This commit is contained in:
parent
0736289ce1
commit
bf94c5dc73
1 changed files with 4 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ import {
|
||||||
MOBILE_OS,
|
MOBILE_OS,
|
||||||
MOBILE_SCREEN_WIDTH,
|
MOBILE_SCREEN_WIDTH,
|
||||||
} from './constants';
|
} from './constants';
|
||||||
|
import { safeDecodeURIComponent } from '@/lib/url';
|
||||||
|
|
||||||
const MAXMIND = 'maxmind';
|
const MAXMIND = 'maxmind';
|
||||||
|
|
||||||
|
|
@ -146,9 +147,9 @@ export async function getClientInfo(request: Request, payload: Record<string, an
|
||||||
const userAgent = payload?.userAgent || request.headers.get('user-agent');
|
const userAgent = payload?.userAgent || request.headers.get('user-agent');
|
||||||
const ip = payload?.ip || getIpAddress(request.headers);
|
const ip = payload?.ip || getIpAddress(request.headers);
|
||||||
const location = await getLocation(ip, request.headers, !!payload?.ip);
|
const location = await getLocation(ip, request.headers, !!payload?.ip);
|
||||||
const country = decodeURIComponent(location?.country || 'UNKNOWN');
|
const country = safeDecodeURIComponent(location?.country);
|
||||||
const region = decodeURIComponent(location?.region || 'UNKNOWN');
|
const region = safeDecodeURIComponent(location?.region);
|
||||||
const city = decodeURIComponent(location?.city || 'UNKNOWN');
|
const city = safeDecodeURIComponent(location?.city);
|
||||||
const browser = browserName(userAgent);
|
const browser = browserName(userAgent);
|
||||||
const os = detectOS(userAgent) as string;
|
const os = detectOS(userAgent) as string;
|
||||||
const device = getDevice(payload?.screen, os);
|
const device = getDevice(payload?.screen, os);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue