From 8f8e8a1e2f3e75213f110f5b882d1d571a840e4a Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Thu, 31 Aug 2023 16:52:38 +0800 Subject: [PATCH] fix: fix lost extname problem after compress image --- client/web/src/utils/file-helper.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/web/src/utils/file-helper.ts b/client/web/src/utils/file-helper.ts index 54757bb6..3f0623bd 100644 --- a/client/web/src/utils/file-helper.ts +++ b/client/web/src/utils/file-helper.ts @@ -163,7 +163,11 @@ export async function compressImage( maxWidth: options?.maxWidth ?? 1920, maxHeight: options?.maxHeight ?? 1080, success(file) { - resolve(file as File); + if (file instanceof File) { + resolve(file); + } else { + resolve(new File([file], file.name)); + } }, error(err) { reject(err);