mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Use safe URI decoding.
This commit is contained in:
parent
a509336bef
commit
b3cad83f08
@ -1,6 +1,6 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { buildUrl } from 'next-basics';
|
import { buildUrl, safeDecodeURIComponent } from 'next-basics';
|
||||||
|
|
||||||
export function useNavigation(): {
|
export function useNavigation(): {
|
||||||
pathname: string;
|
pathname: string;
|
||||||
@ -16,7 +16,7 @@ export function useNavigation(): {
|
|||||||
const obj = {};
|
const obj = {};
|
||||||
|
|
||||||
for (const [key, value] of params.entries()) {
|
for (const [key, value] of params.entries()) {
|
||||||
obj[key] = decodeURIComponent(value);
|
obj[key] = safeDecodeURIComponent(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { StatusLight } from 'react-basics';
|
import { StatusLight } from 'react-basics';
|
||||||
|
import { safeDecodeURIComponent } from 'next-basics';
|
||||||
import { colord } from 'colord';
|
import { colord } from 'colord';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { LegendItem } from 'chart.js/auto';
|
import { LegendItem } from 'chart.js/auto';
|
||||||
@ -31,7 +32,7 @@ export function Legend({
|
|||||||
onClick={() => onClick(item)}
|
onClick={() => onClick(item)}
|
||||||
>
|
>
|
||||||
<StatusLight color={color.alpha(color.alpha() + 0.2).toHex()}>
|
<StatusLight color={color.alpha(color.alpha() + 0.2).toHex()}>
|
||||||
<span className={locale}>{text}</span>
|
<span className={locale}>{safeDecodeURIComponent(text)}</span>
|
||||||
</StatusLight>
|
</StatusLight>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import clickhouse from 'lib/clickhouse';
|
import clickhouse from 'lib/clickhouse';
|
||||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||||
import prisma from 'lib/prisma';
|
import prisma from 'lib/prisma';
|
||||||
|
import { safeDecodeURIComponent } from 'next-basics';
|
||||||
|
|
||||||
export async function getUTM(
|
export async function getUTM(
|
||||||
...args: [
|
...args: [
|
||||||
@ -99,7 +100,7 @@ function parseParameters(data: any[]) {
|
|||||||
|
|
||||||
for (const [key, value] of searchParams) {
|
for (const [key, value] of searchParams) {
|
||||||
if (key.match(/^utm_(\w+)$/)) {
|
if (key.match(/^utm_(\w+)$/)) {
|
||||||
const name = decodeURIComponent(value);
|
const name = safeDecodeURIComponent(value);
|
||||||
if (!obj[key]) {
|
if (!obj[key]) {
|
||||||
obj[key] = { [name]: +num };
|
obj[key] = { [name]: +num };
|
||||||
} else if (!obj[key][name]) {
|
} else if (!obj[key][name]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user