[FIX] mail*: properly handle b64-encoding for attachments
When reading the datas property of an attachment, a base64-encoded stream is expected. The mail.message.schedule_with_attach() method OTOH expects a binary file for attachments, so it should be decoded if extracted from a binary field. bzr revid: odo@openerp.com-20120308155650-blnwf7x2bkmsfue2
This commit is contained in:
parent
66e1ce8606
commit
86a7978d2d
|
@ -263,7 +263,7 @@ class mail_message(osv.osv):
|
|||
attachment_data = {
|
||||
'name': fname,
|
||||
'datas_fname': fname,
|
||||
'datas': fcontent,
|
||||
'datas': fcontent and fcontent.encode('base64'),
|
||||
'res_model': self._name,
|
||||
'res_id': email_msg_id,
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ class mail_compose_message(osv.osv_memory):
|
|||
for mail in self.browse(cr, uid, ids, context=context):
|
||||
attachment = {}
|
||||
for attach in mail.attachment_ids:
|
||||
attachment[attach.datas_fname] = attach.datas
|
||||
attachment[attach.datas_fname] = attach.datas and attach.datas.decode('base64')
|
||||
references = None
|
||||
headers = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue