From 10f3df3ed4af77c2bc9158ea5f8937eb4fe477de Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 26 Nov 2023 23:51:04 +0100 Subject: [PATCH] make sure content is string for post-processing --- src/services/notes.js | 4 ++++ src/services/utils.js | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/services/notes.js b/src/services/notes.js index b89755393..3e63dea8e 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 a0a84e975..517d65ef9 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 };