diff --git a/package.json b/package.json
index 3bc6959f6..50bb9968c 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "trilium",
"productName": "Trilium Notes",
"description": "Trilium Notes",
- "version": "0.45.7",
+ "version": "0.45.8",
"license": "AGPL-3.0-only",
"main": "electron.js",
"bin": {
diff --git a/src/services/build.js b/src/services/build.js
index 18f8a65b8..37e1951e4 100644
--- a/src/services/build.js
+++ b/src/services/build.js
@@ -1 +1 @@
-module.exports = { buildDate:"2020-12-22T20:21:15+01:00", buildRevision: "bdfd760b9d428dc29c45a0e016d12a25af220043" };
+module.exports = { buildDate:"2021-01-11T22:29:31+01:00", buildRevision: "369274ead75947a68bf7bbb5ab1e784e81521030" };
diff --git a/src/services/export/zip.js b/src/services/export/zip.js
index 58d234c66..bc44ba7b0 100644
--- a/src/services/export/zip.js
+++ b/src/services/export/zip.js
@@ -234,7 +234,7 @@ function exportToZip(taskContext, branch, format, res) {
-
+
${utils.escapeHtml(title)}
${content}
diff --git a/src/services/options_init.js b/src/services/options_init.js
index 66fac2477..dd55dcf17 100644
--- a/src/services/options_init.js
+++ b/src/services/options_init.js
@@ -31,10 +31,7 @@ function initNotSyncedOptions(initialized, startNotePath = 'root', opts = {}) {
optionService.createOption('openTabs', JSON.stringify([
{
notePath: startNotePath,
- active: true,
- sidebar: {
- widgets: []
- }
+ active: true
}
]), false);
@@ -102,6 +99,15 @@ function initStartupOptions() {
log.info(`Created missing option "${name}" with default value "${value}"`);
}
}
+
+ if (process.env.TRILIUM_START_NOTE_ID) {
+ optionService.setOption('openTabs', JSON.stringify([
+ {
+ notePath: process.env.TRILIUM_START_NOTE_ID,
+ active: true
+ }
+ ]));
+ }
}
function getKeyboardDefaultOptions() {
diff --git a/src/services/search/expressions/note_content_protected_fulltext.js b/src/services/search/expressions/note_content_protected_fulltext.js
index daed14000..0ed21eb15 100644
--- a/src/services/search/expressions/note_content_protected_fulltext.js
+++ b/src/services/search/expressions/note_content_protected_fulltext.js
@@ -32,11 +32,15 @@ class NoteContentProtectedFulltextExp extends Expression {
FROM notes JOIN note_contents USING (noteId)
WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 1`)) {
+ if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) {
+ continue;
+ }
+
try {
content = protectedSessionService.decryptString(content);
}
catch (e) {
- log.info('Cannot decrypt content of note', noteId);
+ log.info(`Cannot decrypt content of note ${noteId}`);
continue;
}
@@ -50,11 +54,7 @@ class NoteContentProtectedFulltextExp extends Expression {
content = content.replace(/ /g, ' ');
}
- if (this.tokens.find(token => !content.includes(token))) {
- continue;
- }
-
- if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) {
+ if (!this.tokens.find(token => !content.includes(token))) {
resultNoteSet.add(noteCache.notes[noteId]);
}
}
diff --git a/src/services/search/expressions/note_content_unprotected_fulltext.js b/src/services/search/expressions/note_content_unprotected_fulltext.js
index ad0ce7cdf..a9a531269 100644
--- a/src/services/search/expressions/note_content_unprotected_fulltext.js
+++ b/src/services/search/expressions/note_content_unprotected_fulltext.js
@@ -26,6 +26,10 @@ class NoteContentUnprotectedFulltextExp extends Expression {
FROM notes JOIN note_contents USING (noteId)
WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 0`)) {
+ if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) {
+ continue;
+ }
+
content = content.toString().toLowerCase();
if (type === 'text' && mime === 'text/html') {
@@ -36,11 +40,7 @@ class NoteContentUnprotectedFulltextExp extends Expression {
content = content.replace(/ /g, ' ');
}
- if (this.tokens.find(token => !content.includes(token))) {
- continue;
- }
-
- if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) {
+ if (!this.tokens.find(token => !content.includes(token))) {
resultNoteSet.add(noteCache.notes[noteId]);
}
}