fix protecting files/images

This commit is contained in:
zadam
2019-05-04 16:05:28 +02:00
parent a9762c5139
commit 47d28b4eef
3 changed files with 33 additions and 12 deletions

View File

@@ -346,6 +346,11 @@ async function updateNote(noteId, noteUpdates) {
await saveNoteRevision(note);
// if protected status changed, then we need to encrypt/decrypt the content anyway
if (['file', 'image'].includes(note.type) && note.isProtected !== noteUpdates.isProtected) {
noteUpdates.content = await note.getContent();
}
const noteTitleChanged = note.title !== noteUpdates.title;
note.title = noteUpdates.title;
@@ -357,6 +362,9 @@ async function updateNote(noteId, noteUpdates) {
await note.setContent(noteUpdates.content);
}
else if (noteUpdates.content) {
await note.setContent(noteUpdates.content);
}
if (noteTitleChanged) {
await triggerNoteTitleChanged(note);