OCA / knowledge

Odoo Document & Knowledge Management
http://www.odoo-community.org/project/22
GNU Affero General Public License v3.0
153 stars 328 forks source link

[16.0] attachment_zipped_download: Incomplete file #406

Closed DarioLodeiros closed 6 months ago

DarioLodeiros commented 1 year ago

Failed to open the downloaded zips

Module

attachment_zipped_download

Describe the bug

Go to Settings > Technical > Database Structure > Attachments and select some files. Then download files and we can see the error in the downloaded file: image

To Reproduce

Tested in runbot 16.0, in 14.0 this run fine.

https://user-images.githubusercontent.com/11718836/224478304-59a1c32c-d3f0-4812-9ada-85075f830c66.mp4

Expected behavior A clear and concise description of what you expected to happen.

Additional context Tested in Brave 1.48, Chrome 110.0.5481 and Firefox 110.01

pedrobaeza commented 1 year ago

Can you try in local? Currently the runboat certificate is expired, so it can be the reason.

pedrobaeza commented 1 year ago

@sbidoul can you check the certificate part?

DarioLodeiros commented 1 year ago

Sorry, I am left without notifying the response, but yes, indeed I first detected it locally, and then I checked it in runbot. I understand that it is some change in the library that is used in pyhon??,

pedrobaeza commented 1 year ago

I can't say. In previous tests, it was working.

len-foss commented 1 year ago

@pedrobaeza It seems it's an issue with Werkzeug's dealing with the BytesIO object. Adding fo = tempfile.NamedTemporaryFile(); fo.write(out_file.getvalue()) and passing the filename fo.name as argument to send_file works as expected.

In all other cases, it sends the correct size in the headers, but it does not actually stream the file. Not sure what might have changed between versions.

pedrobaeza commented 1 year ago

Thanks for the investigation! Can you do a PR doing that changes?

len-foss commented 1 year ago

Should be good now :-)