Skip to content

Build your personal knowledge base with Trilium Notes

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

zadam02eddc347abe
diff --git a/src/services/protected_session.js b/src/services/protected_session.js
index 83b877aff1..283e04279e 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;