mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
make note cache decryption more robust - one failure will not crash the whole process, #1810
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
const protectedSessionService = require('../../protected_session');
|
||||
const log = require('../../log');
|
||||
|
||||
class Note {
|
||||
constructor(noteCache, row) {
|
||||
@@ -416,9 +417,14 @@ class Note {
|
||||
|
||||
decrypt() {
|
||||
if (this.isProtected && !this.isDecrypted && protectedSessionService.isProtectedSessionAvailable()) {
|
||||
this.title = protectedSessionService.decryptString(this.title);
|
||||
try {
|
||||
this.title = protectedSessionService.decryptString(this.title);
|
||||
|
||||
this.isDecrypted = true;
|
||||
this.isDecrypted = true;
|
||||
}
|
||||
catch (e) {
|
||||
log.error(`Could not decrypt note ${this.noteId}: ${e.message} ${e.stack}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user