Skip to content

Build your personal knowledge base with Trilium Notes

fix corner case when deleting a note with not yet downloaded images, closes #2073

zadamadc98d451530
diff --git a/src/services/notes.js b/src/services/notes.js
index 35514e4ff7..7041db9a11 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -362,6 +362,12 @@ function downloadImages(noteId, content) {
const imageNotes = becca.getNotes(Object.values(imageUrlToNoteIdMapping));
const origNote = becca.getNote(noteId);
+
+ if (!origNote) {
+ log.error(`Cannot find note ${noteId} to replace image link.`);
+ return;
+ }
+
const origContent = origNote.getContent();
let updatedContent = origContent;