From 7c9d07cd536c847b7e1532d31dfa90450402710d 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 623cb0e71..15110b6b7 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 = '';