From e4395f2bfb2a271303e9dc7f91bec6c890e792e3 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 12 Nov 2020 12:27:24 -0300 Subject: [PATCH] 13494: Fixes edge case on file size formatter. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/common/formatters.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/formatters.ts b/src/common/formatters.ts index 55fb0507..17917127 100644 --- a/src/common/formatters.ts +++ b/src/common/formatters.ts @@ -22,6 +22,8 @@ export const formatDate = (isoDate?: string | null, utc: boolean = false) => { export const formatFileSize = (size?: number) => { if (typeof size === "number") { + if (size === 0) { return "0 B"; } + for (const { base, unit } of FILE_SIZES) { if (size >= base) { return `${(size / base).toFixed()} ${unit}`; -- 2.30.2