From 02eddc347abebce63a8882f6f83ac73655005849 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 7 Mar 2019 22:00:23 +0100 Subject: [PATCH] fix export of protected notes to tar archive, fixes #432 --- src/services/protected_session.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/protected_session.js b/src/services/protected_session.js index 83b877aff..283e04279 100644 --- a/src/services/protected_session.js +++ b/src/services/protected_session.js @@ -15,7 +15,7 @@ function setDataKey(decryptedDataKey) { } function setProtectedSessionId(req) { - cls.namespace.set('protectedSessionId', req.headers['trilium-protected-session-id']); + cls.namespace.set('protectedSessionId', req.headers['trilium-protected-session-id'] || req.query.protectedSessionId); } function getProtectedSessionId() { @@ -62,7 +62,9 @@ function decryptNoteContent(noteContent) { } try { - noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content); + if (noteContent.content != null) { + noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content.toString()); + } } catch (e) { e.message = `Cannot decrypt note content for noteContentId=${noteContent.noteContentId}: ` + e.message;