editor: fix crash due to attachment.mime being undefined

This commit is contained in:
Abdullah Atta
2023-05-29 13:12:28 +05:00
parent 792a254513
commit 3742e923c9

View File

@@ -103,7 +103,10 @@ const previewableMimeTypes = ["application/pdf"];
function canPreviewAttachment(attachment: Attachment) {
if (!attachment) return false;
if (previewableMimeTypes.some((mime) => attachment.mime.startsWith(mime)))
if (
attachment.mime &&
previewableMimeTypes.some((mime) => attachment.mime.startsWith(mime))
)
return true;
const extension = attachment.filename?.split(".").pop();