fix: fix lost extname problem after compress image

pull/150/head
moonrailgun 2 years ago
parent 98e81fa9b7
commit 8f8e8a1e2f

@ -163,7 +163,11 @@ export async function compressImage(
maxWidth: options?.maxWidth ?? 1920, maxWidth: options?.maxWidth ?? 1920,
maxHeight: options?.maxHeight ?? 1080, maxHeight: options?.maxHeight ?? 1080,
success(file) { success(file) {
resolve(file as File); if (file instanceof File) {
resolve(file);
} else {
resolve(new File([file], file.name));
}
}, },
error(err) { error(err) {
reject(err); reject(err);

Loading…
Cancel
Save