-
-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][FIX] attachment_zipped_download: create temporary file to stream #430
Conversation
Before the fix, 0 bytes would be transferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
Is there any reason not to merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good but I've the feeling it's a shame here, we have a new class to manage stream and we are not using it...
_create_temp_zip()
return a BytesIO
the getvalue()
return the raw bytes which is then transform again as a bytesIO by the htpp.Stream
class. In a large zip file this could be a lot of memory.
The title told us that it create a temporary file to stream but I don't think it's the case with this change. I've the feeling it would be probably better to do that, change a bit _create_temp_zip to write a temporary file and use Stream with type="path"
As far i understand this mainly avoid to use a deprecated method that I won't be opposed, the improvement can come later !
The history is lost because I force-pushed the branch (a long time ago so it was pruned); the first version used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review
/ocabot merge patch |
On my way to merge this fine PR! |
Congratulations, your PR was merged at dafab10. Thanks a lot for contributing to OCA. ❤️ |
Despite accurately getting the size from the BytesIO object, Werkzeug doesn't stream its content.
This updates the code to use Odoo's http.Stream class.
Fixes #406