Skip to content
Snippets Groups Projects
Commit 3bda53a7 authored by Sébastien Theys's avatar Sébastien Theys
Browse files

[FIX] website_mail_channel: prevent crash in python3 email lib

`AttributeError: 'tuple' object has no attribute 'startswith'`

When given headers that are tuples. They are expected to be string, as per [1].
The issue was introduced with [2], indeed the code was moved from inside a dict
where `,` was the usual dict separator to outside of a dict where `,` at the end
made them tuples.

To reproduce the issue, run the `test_mail` suite after having
`website_mail_channel` installed.

Issue highlighted as part of task-2178641

[1] https://docs.python.org/3/library/email.policy.html#email.policy.Policy.header_store_parse


[2] cae1c397

closes odoo/odoo#43675

Signed-off-by: default avatarAlexandre Kühn (aku) <aku@odoo.com>
parent 4335f9db
No related branches found
No related tags found
No related merge requests found
......@@ -21,9 +21,9 @@ class MailGroup(models.Model):
except Exception:
headers = {}
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
headers['List-Archive'] = '<%s/groups/%s>' % (base_url, slug(self)),
headers['List-Subscribe'] = '<%s/groups>' % (base_url),
headers['List-Unsubscribe'] = '<%s/groups?unsubscribe>' % (base_url,),
headers['List-Archive'] = '<%s/groups/%s>' % (base_url, slug(self))
headers['List-Subscribe'] = '<%s/groups>' % (base_url)
headers['List-Unsubscribe'] = '<%s/groups?unsubscribe>' % (base_url,)
res['headers'] = repr(headers)
return res
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment