From c2b4ab0f2d7b31ff7d96a9723b7c5283d7f72f6c Mon Sep 17 00:00:00 2001 From: len Date: Fri, 8 Sep 2023 17:06:56 +0200 Subject: [PATCH] [FIX] attachment_zipped_download: fix stream download Before the fix, 0 bytes would be transferred. --- attachment_zipped_download/controllers/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/attachment_zipped_download/controllers/main.py b/attachment_zipped_download/controllers/main.py index f4b5f973..e14f5cb6 100644 --- a/attachment_zipped_download/controllers/main.py +++ b/attachment_zipped_download/controllers/main.py @@ -13,9 +13,11 @@ class AttachmentZippedDownloadController(http.Controller): return list_ids = map(int, ids.split(",")) out_file = request.env["ir.attachment"].browse(list_ids)._create_temp_zip() - return http.send_file( - filepath_or_fp=out_file, + stream = http.Stream( + type="data", + data=out_file.getvalue(), mimetype="application/zip", as_attachment=True, - filename=_("attachments.zip"), + download_name=_("attachments.zip"), ) + return stream.get_response()