[backend/federation] Fix compatibility with AP servers that send <br> without a trailing newline character

This commit is contained in:
Laura Hausmann 2025-01-05 04:32:50 +01:00
parent 729e32594b
commit 4d904bc673
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -53,7 +53,7 @@ public class MfmConverter(
if (html == null) return new HtmlMfmData("", media); if (html == null) return new HtmlMfmData("", media);
// Ensure compatibility with AP servers that send both <br> as well as newlines // Ensure compatibility with AP servers that send both <br> as well as newlines
var regex = new Regex(@"<br\s?\/?>\r?\n", RegexOptions.IgnoreCase); var regex = new Regex(@"<br\s?\/?>(?:\r?\n)?", RegexOptions.IgnoreCase);
html = regex.Replace(html, "\n"); html = regex.Replace(html, "\n");
// Ensure compatibility with AP servers that send non-breaking space characters instead of regular spaces // Ensure compatibility with AP servers that send non-breaking space characters instead of regular spaces