summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann150 <johann.galle@protonmail.com>2022-05-31 11:57:55 +0200
committerGitHub <noreply@github.com>2022-05-31 18:57:55 +0900
commit025bf4a5e77f78928b21e77ceb33bc05a8ce642e (patch)
tree46507c4d4d677b876a27ac9a7bdc4310cf7d7ce7
parentExtract commonly used test logic to commands (#8767) (diff)
downloadmisskey-025bf4a5e77f78928b21e77ceb33bc05a8ce642e.tar.gz
misskey-025bf4a5e77f78928b21e77ceb33bc05a8ce642e.tar.bz2
misskey-025bf4a5e77f78928b21e77ceb33bc05a8ce642e.zip
fix(mfm): remove duplicate br tag/newline (#8616)
-rw-r--r--packages/backend/src/mfm/from-html.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/backend/src/mfm/from-html.ts b/packages/backend/src/mfm/from-html.ts
index 623cb0e71c..15110b6b70 100644
--- a/packages/backend/src/mfm/from-html.ts
+++ b/packages/backend/src/mfm/from-html.ts
@@ -6,6 +6,9 @@ const urlRegex = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+/;
const urlRegexFull = /^https?:\/\/[\w\/:%#@$&?!()\[\]~.,=+\-]+$/;
export function fromHtml(html: string, hashtagNames?: string[]): string {
+ // some AP servers like Pixelfed use br tags as well as newlines
+ html = html.replace(/<br\s?\/?>\r?\n/gi, '\n');
+
const dom = parse5.parseFragment(html);
let text = '';