From 5a454139da16e0fa052daefe040a807ef0b295fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Fri, 19 Oct 2018 13:01:06 +0200 Subject: [PATCH] Do not print bytes with decimal place --- scm-ui/src/repos/sources/components/FileSize.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-ui/src/repos/sources/components/FileSize.js b/scm-ui/src/repos/sources/components/FileSize.js index d45157237d..c7d966d901 100644 --- a/scm-ui/src/repos/sources/components/FileSize.js +++ b/scm-ui/src/repos/sources/components/FileSize.js @@ -14,7 +14,7 @@ class FileSize extends React.Component { const units = ["B", "K", "M", "G", "T", "P", "E", "Z", "Y"]; const i = Math.floor(Math.log(bytes) / Math.log(1024)); - const size = (bytes / 1024 ** i).toFixed(2); + const size = i === 0 ? bytes : (bytes / 1024 ** i).toFixed(2); return `${size} ${units[i]}`; }