From 059dc88d17723af631e7bbb4f8da00b74b72a9b5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Dufays Date: Fri, 31 Mar 2023 14:06:06 +0000 Subject: [PATCH] [IMP] web: update upload service docstring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the upload service (js) only uses iteration, index based access and length on the files parameter, it is compatible as well with an array of File as files parameter (instead of a FileList). So, we have updated the files parameter docstring to accept as well array of File. With this change we can easily pass a modified list of files (ListFile being hard to create on some browser). Example of use-case, only send to the upload service the files smaller than a given threshold by transforming a FileList to an array and then by filtering it. Task-3179130 closes odoo/odoo#117385 Related: odoo/enterprise#38490 Signed-off-by: Warnon Aurélien (awa) --- addons/web/static/src/core/file_upload/file_upload_service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/core/file_upload/file_upload_service.js b/addons/web/static/src/core/file_upload/file_upload_service.js index fa31a435884..a57b699930a 100644 --- a/addons/web/static/src/core/file_upload/file_upload_service.js +++ b/addons/web/static/src/core/file_upload/file_upload_service.js @@ -24,7 +24,7 @@ export const fileUploadService = { /** * @param {string} route - * @param {FileList} files + * @param {FileList|Array} files * @param {Object} [params] * @param {function(formData): void} [params.buildFormData] * @param {Boolean} [params.displayErrorNotification]