Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix crash due to attachment.mime being undefined

Abdullah Atta3742e923c942
diff --git a/packages/editor/src/toolbar/tools/attachment.tsx b/packages/editor/src/toolbar/tools/attachment.tsx
index 68d066f19..b284434f3 100644
--- a/packages/editor/src/toolbar/tools/attachment.tsx
+++ b/packages/editor/src/toolbar/tools/attachment.tsx
@@ -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();