From ccfee28e133562f32e33d4cb2c61cc15157f0499 Mon Sep 17 00:00:00 2001 From: HD Date: Tue, 28 Jun 2022 10:35:11 +0800 Subject: [PATCH] fix: file size calculation error MDN: The Blob interface's size property returns the size of the Blob or File in bytes --- src/common/utils.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/utils.tsx b/src/common/utils.tsx index 5b87e231..9a56b776 100644 --- a/src/common/utils.tsx +++ b/src/common/utils.tsx @@ -14,8 +14,7 @@ export const isImage = (file_type = "", size = 0) => { export const isTreatAsImage = (file: File) => { const { type, size } = file; if (type.startsWith("image")) { - // 10MB - return size < 1000 * 1000; + return size < 1024 * 1024; // 10MB } return false; };