From f3605e3982863cd8192ece333adbb9d068bbfb3e Mon Sep 17 00:00:00 2001
From: Andrew Marwood
Date: Tue, 5 Apr 2022 21:44:44 +1000
Subject: [PATCH] fix(email) insert carriage return at end of pars (#2331)
---
.../publish/formatters/email_formatter.py | 4 ++-
.../formatters/email_formatter_test.py | 30 ++++++++++++++++---
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/superdesk/publish/formatters/email_formatter.py b/superdesk/publish/formatters/email_formatter.py
index c08ebb2d1f..50da11c64d 100644
--- a/superdesk/publish/formatters/email_formatter.py
+++ b/superdesk/publish/formatters/email_formatter.py
@@ -59,7 +59,9 @@ def format(self, article, subscriber, codes=None):
if formatted_article.get("dateline", {}).get("text"):
# If there is a dateline inject it into the body
self._inject_dateline(formatted_article)
- doc["message_html"] = render_template("email_article_body.html", article=formatted_article)
+ doc["message_html"] = render_template("email_article_body.html", article=formatted_article).replace(
+ "
", "\r"
+ )
else:
doc["message_html"] = None
doc["message_text"] = render_template("email_article_body.txt", article=formatted_article)
diff --git a/tests/publish/formatters/email_formatter_test.py b/tests/publish/formatters/email_formatter_test.py
index 0884880bc8..03a3fee58f 100644
--- a/tests/publish/formatters/email_formatter_test.py
+++ b/tests/publish/formatters/email_formatter_test.py
@@ -58,7 +58,7 @@ def test_formatter(self):
" take \n"
'
\n
Very good story'
"
\nCan of beans\n
joe\n
\n"
- "BERN, July 13 - The story body of the story so far
\n
\n"
+ "BERN, July 13 - The story body of the story so far
\r\n
\n"
"AAP aa/bb\n\n