From 9467f818b6eafd025104c7c209e40698c9be8ccb Mon Sep 17 00:00:00 2001 From: AntoineGrandchamp Date: Tue, 15 Sep 2020 08:01:51 -0400 Subject: [PATCH] Binary system instead of decimal for size error --- src/helpers.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index 631c0759..b9b6398c 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -6,11 +6,10 @@ export function isImage(file) { export function convertBytesToMbsOrKbs(filesize) { let size = ''; - // I know, not technically correct... - if (filesize >= 1000000) { - size = (filesize / 1000000) + ' megabytes'; - } else if (filesize >= 1000) { - size = (filesize / 1000) + ' kilobytes'; + if (filesize >= 1048576) { + size = (filesize / 1048576) + ' megabytes'; + } else if (filesize >= 1024) { + size = (filesize / 1024) + ' kilobytes'; } else { size = filesize + ' bytes'; }