From f3280b4dd58a97e7073e999230abd65e04e2fba3 Mon Sep 17 00:00:00 2001 From: ElonH Date: Fri, 29 May 2020 15:02:30 +0800 Subject: [PATCH] fix(format-bytes): handle size less than 0 (directory) --- src/app/utils/format-bytes.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/utils/format-bytes.ts b/src/app/utils/format-bytes.ts index 3c27966..e7630fe 100644 --- a/src/app/utils/format-bytes.ts +++ b/src/app/utils/format-bytes.ts @@ -3,6 +3,7 @@ * License: MIT */ export function FormatBytes(bytes: number, decimals = 2) { + if (bytes < 0) return '-'; if (bytes === 0) return '0 B'; const k = 1024;