Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix recursion in the inline image processing
zadame0d4766c2dc2
diff --git a/src/services/image.js b/src/services/image.jsindex de71493f3d..111a777711 100644--- a/src/services/image.js+++ b/src/services/image.js@@ -148,8 +148,16 @@ function saveImageToAttachment(noteId, uploadBuffer, originalName, shrinkImageSwtitle: fileName});- const noteService = require("../services/notes");- noteService.asyncPostProcessContent(note, note.getContent()); // to mark an unused attachment for deletion+ // TODO: this is a quick-fix solution of a recursive bug - this is called from asyncPostProcessContent()+ // find some async way to do this - perhaps some global timeout with a Set of noteIds needing one more+ // run of asyncPostProcessContent+ setTimeout(() => {+ sql.transactional(() => {+ const note = becca.getNoteOrThrow(noteId);+ const noteService = require("../services/notes");+ noteService.asyncPostProcessContent(note, note.getContent()); // to mark an unused attachment for deletion+ });+ }, 5000);// resizing images asynchronously since JIMP does not support sync operationprocessImage(uploadBuffer, originalName, shrinkImageSwitch).then(({buffer, imageFormat}) => {