From 4d5612e845e3238b7a7f184627f1eefaeca52471 Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 7 May 2023 11:20:51 +0200 Subject: [PATCH] fix updating non-text notes --- src/routes/api/notes.js | 4 ++-- src/services/notes.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/routes/api/notes.js b/src/routes/api/notes.js index 4a67d1112..5ea556eba 100644 --- a/src/routes/api/notes.js +++ b/src/routes/api/notes.js @@ -55,10 +55,10 @@ function createNote(req) { } function updateNoteData(req) { - const {content, attachments} = req.body; + const {content} = req.body; const {noteId} = req.params; - return noteService.updateNoteData(noteId, content, attachments); + return noteService.updateNoteData(noteId, content); } function deleteNote(req) { diff --git a/src/services/notes.js b/src/services/notes.js index 237a7bbf3..6fe949115 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -575,12 +575,12 @@ function downloadImages(noteId, content) { } function saveLinks(note, content) { - if (note.type !== 'text' && note.type !== 'relationMap') { - return content; - } - - if (note.isProtected && !protectedSessionService.isProtectedSessionAvailable()) { - return content; + if ((note.type !== 'text' && note.type !== 'relationMap') + || (note.isProtected && !protectedSessionService.isProtectedSessionAvailable())) { + return { + forceFrontendReload: false, + content + }; } const foundLinks = []; @@ -599,7 +599,7 @@ function saveLinks(note, content) { findRelationMapLinks(content, foundLinks); } else { - throw new Error(`Unrecognized type ${note.type}`); + throw new Error(`Unrecognized type '${note.type}'`); } const existingLinks = note.getRelations().filter(rel =>