summaryrefslogtreecommitdiff
path: root/addons/mail/models/mail_thread.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-11-30 15:27:59 +0100
committerChristophe Simonis <chs@odoo.com>2017-11-30 15:27:59 +0100
commitab084d580ff0edf9be1d12cec87aeffdd84459b7 (patch)
tree6a19b4656315d94b65c88507bb471ac56d16f3ed /addons/mail/models/mail_thread.py
parent3f66814a0d01a81bef5456a07da4b1ac8e2281e7 (diff)
parent98539336a5d40de748764ff0a3c16d8cda77b02f (diff)
[MERGE] forward port branch saas-15 up to 98539336a5d
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')