diff options
Diffstat (limited to 'addons/mail/models/mail_thread.py')
| -rw-r--r-- | addons/mail/models/mail_thread.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index b681e18d284..679f1726e75 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -1371,6 +1371,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 = [] @@ -1406,7 +1408,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') |
