Skip to content

Build your personal knowledge base with Trilium Notes

fix(import/enex): "Missing or wrong content type for resource" (fixes #943)

Elian Doran24c02e013b95
diff --git a/src/services/import/enex.ts b/src/services/import/enex.ts
index 9ac0641094..ae248ab753 100644
--- a/src/services/import/enex.ts
+++ b/src/services/import/enex.ts
@@ -315,14 +315,10 @@ function importEnex(taskContext: TaskContext, file: File, parentNote: BNote): Pr
resource.mime = resource.mime || "application/octet-stream";
const createFileNote = () => {
- if (typeof resource.content !== "string") {
- throw new Error("Missing or wrong content type for resource.");
- }
-
const resourceNote = noteService.createNewNote({
parentNoteId: noteEntity.noteId,
title: resource.title,
- content: resource.content,
+ content: resource.content ?? "",
type: "file",
mime: resource.mime,
isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable()