Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.0][FIX] Filter attachments if datas is not set on mail sending #31980

Open
wants to merge 1 commit into
base: 11.0
from

Conversation

Projects
None yet
2 participants
@hveficent
Copy link

commented Mar 20, 2019

Description of the issue/feature this PR addresses:
If an email reach Email Manager and any attachment can't be processed, it creates an False/null datas attachment field pointing filestore location. In particular, it has happen to me with application/octet-stream ones. more info. Email Manager is unable to send forward this emails keep them on Delivery Failed state forever.

Current behavior before PR:
If an email has an attachment related with no content when send email method looks for attachments on filestore it crashes like that:

Traceback (most recent call last):
    File "/opt/odoo/odoo11/addons/mail/models/mail_mail.py", line 288, in _send
    for a in mail.attachment_ids.sudo().read(['datas_fname', 'datas', 'mimetype'])]
    File "/opt/odoo/odoo11/addons/mail/models/mail_mail.py", line 288, in <listcomp>
    for a in mail.attachment_ids.sudo().read(['datas_fname', 'datas', 'mimetype'])]
    File "/home/odoo/odoo11-env/lib/python3.6/base64.py", line 80, in b64decode
    s = _bytes_from_decode_data(s)
    File "/home/odoo/odoo11-env/lib/python3.6/base64.py", line 46, in _bytes_from_decode_data
    "string, not %r" % s.__class__.__name__) from None
TypeError: argument should be a bytes-like object or ASCII string, not 'bool'

Desired behavior after PR is merged:

If an email has an attachment like described above, this filter avoids to take it.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.