fix export of protected notes to tar archive, fixes #432

This commit is contained in:
zadam 2019-03-07 22:00:23 +01:00
parent ee58bf3d5c
commit 02eddc347a

View File

@ -15,7 +15,7 @@ function setDataKey(decryptedDataKey) {
} }
function setProtectedSessionId(req) { 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() { function getProtectedSessionId() {
@ -62,7 +62,9 @@ function decryptNoteContent(noteContent) {
} }
try { try {
noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content); if (noteContent.content != null) {
noteContent.content = dataEncryptionService.decrypt(getDataKey(), noteContent.content.toString());
}
} }
catch (e) { catch (e) {
e.message = `Cannot decrypt note content for noteContentId=${noteContent.noteContentId}: ` + e.message; e.message = `Cannot decrypt note content for noteContentId=${noteContent.noteContentId}: ` + e.message;