From d0c4022fa4f9c085e20bf4bc166b33e2dbce0f5a Mon Sep 17 00:00:00 2001 From: miruka Date: Mon, 29 Jun 2020 09:07:44 -0400 Subject: [PATCH] Fix plaintext reply source body formatting --- src/backend/matrix_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index f988d3c5..9fcb4f83 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -422,7 +422,11 @@ class MatrixClient(nio.AsyncClient): source_body = getattr(to.source, "body", "") content["format"] = "org.matrix.custom.html" - content["body"] = f"> <{to.sender_id}> {source_body}\n{text}" + plain_source_body = "\n".join( + f"> <{to.sender_id}> {line}" if i == 0 else f"> {line}" + for i, line in enumerate(source_body.splitlines()) + ) + content["body"] = f"{plain_source_body}\n\n{text}" to_html = REPLY_FALLBACK.format( room_id = room_id,