[FIX] portal: prevent crash on chatter post if no attachment given

Follow up of 3620cb68a0

`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>
This commit is contained in:
Sébastien Theys
2019-08-16 15:26:59 +00:00
parent 9a0fedfc65
commit d0cf08aa57
+2 -2
View File
@@ -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):