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 issue with unicode filtering. Closes #1258

Mike Cao358c725828c2
diff --git a/components/metrics/FilterTags.js b/components/metrics/FilterTags.js
index 077053d04..5b8ed63c5 100644
--- a/components/metrics/FilterTags.js
+++ b/components/metrics/FilterTags.js
@@ -2,6 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import Button from 'components/common/Button';
import Times from 'assets/times.svg';
+import { safeDecodeURI } from 'lib/url';
import styles from './FilterTags.module.css';
export default function FilterTags({ params, onClick }) {
@@ -17,7 +18,7 @@ export default function FilterTags({ params, onClick }) {
return (
<div key={key} className={styles.tag}>
<Button icon={<Times />} onClick={() => onClick(key)} variant="action" iconRight>
- {`${key}: ${params[key]}`}
+ {`${key}: ${safeDecodeURI(params[key])}`}
</Button>
</div>
);
diff --git a/pages/api/website/[id]/stats.js b/pages/api/website/[id]/stats.js
index 7f37574ca..bd32c79d0 100644
--- a/pages/api/website/[id]/stats.js
+++ b/pages/api/website/[id]/stats.js
@@ -41,7 +41,7 @@ export default async (req, res) => {
const stats = Object.keys(metrics[0]).reduce((obj, key) => {
obj[key] = {
value: Number(metrics[0][key]) || 0,
- change: Number(metrics[0][key] - prevPeriod[0][key]) || 0,
+ change: Number(metrics[0][key]) - Number(prevPeriod[0][key]) || 0,
};
return obj;
}, {});