Skip to content

Commit

Permalink
fix: fix lost extname problem after compress image
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Aug 31, 2023
1 parent 98e81fa commit 8f8e8a1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/web/src/utils/file-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8f8e8a1

Please sign in to comment.