diff --git a/app/utils/chat.ts b/app/utils/chat.ts index 991d06b73..6669cab01 100644 --- a/app/utils/chat.ts +++ b/app/utils/chat.ts @@ -39,7 +39,10 @@ export function compressImage(file: File, maxSize: number): Promise { }; reader.onerror = reject; - if (file.type.includes("heic")) { + if ( + file.name.toLowerCase().endsWith(".heic") || + file.type.includes("heic") + ) { heic2any({ blob: file, toType: "image/jpeg" }) .then((blob) => { reader.readAsDataURL(blob as Blob); @@ -47,8 +50,8 @@ export function compressImage(file: File, maxSize: number): Promise { .catch((e) => { reject(e); }); + } else { + reader.readAsDataURL(file); } - - reader.readAsDataURL(file); }); }