summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail/models/mail_thread.py')
-rw-r--r--addons/mail/models/mail_thread.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py
index 7a0ec8a65d0..b5aa6616794 100644
--- a/addons/mail/models/mail_thread.py
+++ b/addons/mail/models/mail_thread.py
@@ -1365,6 +1365,8 @@ class MailThread(models.AbstractModel):
mail module, and should not contain security or generic html cleaning.
Indeed those aspects should be covered by the html_sanitize method
located in tools. """
+ if not body:
+ return body, attachments
root = lxml.html.fromstring(body)
postprocessed = False
to_remove = []
@@ -1399,7 +1401,7 @@ class MailThread(models.AbstractModel):
# Content-Type: multipart/related;
# boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_";
# type="text/html"
- if not message.is_multipart() or message.get('content-type', '').startswith("text/"):
+ if message.get_content_maintype() == 'text':
encoding = message.get_content_charset()
body = message.get_payload(decode=True)
body = tools.ustr(body, encoding, errors='replace')