Skip to content

armgit / dashy

Public Imported from GitHub
0

🚀 A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:lock: Feed input through parseFlot() as means of sanitisation

Marcell Fülöp7d8d3078b262
diff --git a/src/utils/MiscHelpers.js b/src/utils/MiscHelpers.js
index 14e6c808..11e834bc 100644
--- a/src/utils/MiscHelpers.js
+++ b/src/utils/MiscHelpers.js
@@ -113,7 +113,7 @@ export const formatNumber = (number, decimals = 1) => {
const units = ['', 'K', 'M', 'B', 'T'];
const k = 1000;
const i = Math.floor(Math.log(number) / Math.log(k));
- const f = number / (k ** i);
+ const f = parseFloat(number / (k ** i));
const d = f.toFixed(decimals) % 1.0 === 0 ? 0 : decimals; // number of decimals, omit .0
return `${f.toFixed(d)}${units[i]}`;
};