diff options
| author | Sébastien Theys <seb@odoo.com> | 2019-08-16 15:26:59 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2019-08-16 15:26:59 +0000 |
| commit | d0cf08aa57d9a2b83b6418f5eab6d8a7ea6e7454 (patch) | |
| tree | d1ac0f2ba6ce1d9521a1ec5dbaa855f3feaebb2c /addons | |
| parent | 9a0fedfc657a71cd79aad03b562d6bc1b762422d (diff) | |
[FIX] portal: prevent crash on chatter post if no attachment given
Follow up of 3620cb68a0190031d3e1a963d8554834ab7f192b
`split` called on an empty string returns a list containing the empty string.
The previous commit assumed it was returning an empty list.
closes odoo/odoo#35773
Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/portal/controllers/mail.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/portal/controllers/mail.py b/addons/portal/controllers/mail.py index f06f14a1b56..1f776bb6ab1 100644 --- a/addons/portal/controllers/mail.py +++ b/addons/portal/controllers/mail.py @@ -98,8 +98,8 @@ class PortalChatter(http.Controller): res_id = int(res_id) - attachment_ids = [int(res_id) for res_id in attachment_ids.split(',')] - attachment_tokens = attachment_tokens.split(',') + attachment_ids = [int(attachment_id) for attachment_id in attachment_ids.split(',') if attachment_id] + attachment_tokens = [attachment_token for attachment_token in attachment_tokens.split(',') if attachment_token] if len(attachment_tokens) != len(attachment_ids): raise UserError(_("An access token must be provided for each attachment.")) for (attachment_id, access_token) in zip(attachment_ids, attachment_tokens): |
