Skip to content

Build your personal knowledge base with Trilium Notes

make sure content is string for post-processing

zadam10f3df3ed4af
diff --git a/src/services/notes.js b/src/services/notes.js
index b897553935..3e63dea8e1 100644
--- a/src/services/notes.js
+++ b/src/services/notes.js
@@ -889,6 +889,10 @@ function scanForLinks(note, content) {
* Things which have to be executed after updating content, but asynchronously (separate transaction)
*/
async function asyncPostProcessContent(note, content) {
+ if (note.hasStringContent() && !utils.isString(content)) {
+ content = content.toString();
+ }
+
scanForLinks(note, content);
}
diff --git a/src/services/utils.js b/src/services/utils.js
index a0a84e975f..517d65ef95 100644
--- a/src/services/utils.js
+++ b/src/services/utils.js
@@ -303,6 +303,10 @@ function toMap(list, key) {
return map;
}
+function isString(x) {
+ return Object.prototype.toString.call(x) === "[object String]";
+}
+
module.exports = {
randomSecureToken,
randomString,
@@ -335,4 +339,5 @@ module.exports = {
normalize,
hashedBlobId,
toMap,
+ isString
};