From 953c95f4855a2735e85151018d2da4b2bbe070b9 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Thu, 7 Dec 2023 09:56:09 +0100 Subject: [PATCH] Fixes bug in the sizify function --- svr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svr.js b/svr.js index 726cb1f..e8bf293 100644 --- a/svr.js +++ b/svr.js @@ -504,7 +504,7 @@ function sizify(bytes, addI) { if (bytes == 0) return "0"; if (bytes < 0) bytes = -bytes; var prefixes = ["", "K", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q"]; - var prefixIndex = Math.floor(Math.log2 ? Math.log2(bytes) / 10 : (Math.log(bytes) / Math.log(2) * 10)); + var prefixIndex = Math.floor(Math.log2 ? Math.log2(bytes) / 10 : (Math.log(bytes) / (Math.log(2) * 10))); if (prefixIndex >= prefixes.length - 1) prefixIndex = prefixes.length - 1; var prefixIndexTranslated = Math.pow(2, 10 * prefixIndex); var decimalPoints = 2 - Math.floor(Math.log10 ? Math.log10(bytes / prefixIndexTranslated) : (Math.log(bytes / prefixIndexTranslated) / Math.log(10)));