From fe37faedc046a1b3f7051800c11087929061a1af Mon Sep 17 00:00:00 2001 From: Cynthia Date: Tue, 6 Dec 2022 11:02:46 -0700 Subject: [PATCH] fedimbed: fix newlines getting stripped --- src/modules/fedimbed.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 83562ac..f33f26f 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -190,7 +190,8 @@ async function processUrl(msg, url) { } } } else { - content = postData.content; + content = + postData._misskey_content ?? postData.source?.content ?? postData.content; cw = postData.summary; timestamp = postData.published; for (const attachment of postData.attachment) { @@ -251,6 +252,7 @@ async function processUrl(msg, url) { cw = cw ?? ""; // TODO: convert certain HTML tags back to markdown + content = content.replace(/
/g, "\n"); content = content.replace(/(<([^>]+)>)/gi, ""); content = parseHtmlEntities(content); @@ -405,7 +407,7 @@ async function processUrl(msg, url) { .then((buf) => Buffer.from(buf)); files.push({ - name: attachment.type.replace("/", ".").replace("mpeg","mp3"), + name: attachment.type.replace("/", ".").replace("mpeg", "mp3"), contents: file, }); }