diff options
| author | Christophe Simonis <chs@odoo.com> | 2014-06-03 19:14:22 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2014-06-03 19:14:22 +0200 |
| commit | 65f68c1f653a9f491cded87cd223949cc2c02493 (patch) | |
| tree | 5a3872173c1e6cebbf6bcf7838d768da24cb3d5c /addons/mail/mail_thread.py | |
| parent | eafa5ff0b59dcde001200633b1c585abd3849671 (diff) | |
| parent | 7dd69540e8ee223a2d14b00f8435fd08e935b170 (diff) | |
[MERGE] forward port of branch saas-3 up to 7dd6954
Diffstat (limited to 'addons/mail/mail_thread.py')
| -rw-r--r-- | addons/mail/mail_thread.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 9acfb07c13b..cc74f25dcde 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -1164,7 +1164,14 @@ class mail_thread(osv.AbstractModel): body = u'' if save_original: attachments.append(('original_email.eml', message.as_string())) - if not message.is_multipart() or 'text/' in message.get('content-type', ''): + + # Be careful, content-type may contain tricky content like in the + # following example so test the MIME type with startswith() + # + # Content-Type: multipart/related; + # boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_"; + # type="text/html" + if not message.is_multipart() or message.get('content-type', '').startswith("text/"): encoding = message.get_content_charset() body = message.get_payload(decode=True) body = tools.ustr(body, encoding, errors='replace') @@ -1893,4 +1900,4 @@ class mail_thread(osv.AbstractModel): message_obj.write(cr, uid, msg_ids_comment, {"res_id" : new_res_id, "model" : new_model}, context=context) message_obj.write(cr, uid, msg_ids_not_comment, {"res_id" : new_res_id, "model" : new_model, "subtype_id" : None}, context=context) - return True
\ No newline at end of file + return True |
