[FIX] portal: no crash on adding file in chatter portal

In follow-up https://github.com/odoo/odoo/pull/120437

PR above replaces `underscore.js` `map` by native `.map()`.
The `map` of `underscore.js` accepts anything, even
mapping on `FileList`. However, native `map` needs to
apply on an array.

This commit fixes the issue by ensuring `.map()` is applied
on an array.

Task-3366632

closes odoo/odoo#124750

X-original-commit: fec9cc476134dcdde007ce6fb0c0bee63e38cca1
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-06-13 10:13:46 +02:00
parent 074a91a300
commit cd803877ce
@@ -115,7 +115,7 @@ var PortalComposer = publicWidget.Widget.extend({
this.$sendButton.prop('disabled', true);
return Promise.all(this.$fileInput[0].files.map((file) => {
return Promise.all([...this.$fileInput[0].files].map((file) => {
return new Promise(function (resolve, reject) {
var data = self._prepareAttachmentData(file);
ajax.post('/portal/attachment/add', data).then(function (attachment) {