From 025bf4a5e77f78928b21e77ceb33bc05a8ce642e Mon Sep 17 00:00:00 2001 From: Johann150 Date: Tue, 31 May 2022 11:57:55 +0200 Subject: [PATCH] fix(mfm): remove duplicate br tag/newline (#8616) --- packages/backend/src/mfm/from-html.ts | 3 +++ 1 file changed, 3 insertions(+) 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(/\r?\n/gi, '\n'); + const dom = parse5.parseFragment(html); let text = '';