[FIX] http: rewind file upload on serialization failure
Before this commit:
When uploading a file, if the transaction fails due to a serialization
failure, Odoo will retry the request. However, if a file upload is read
during the transaction, the file pointer will be at the end of the file,
and calling `.read()` again returns an empty bytes object.
After this commit:
Upon retrying the request, rewind uploads to the beginning of the file,
if the file supports it.
opw-3228200
closes odoo/odoo#117669
Signed-off-by:
Julien Castiaux (juc) <juc@odoo.com>
Showing
- odoo/addons/test_http/__init__.py 1 addition, 0 deletionsodoo/addons/test_http/__init__.py
- odoo/addons/test_http/__manifest__.py 11 additions, 0 deletionsodoo/addons/test_http/__manifest__.py
- odoo/addons/test_http/controllers.py 29 additions, 0 deletionsodoo/addons/test_http/controllers.py
- odoo/addons/test_http/tests/__init__.py 1 addition, 0 deletionsodoo/addons/test_http/tests/__init__.py
- odoo/addons/test_http/tests/test_upload.py 17 additions, 0 deletionsodoo/addons/test_http/tests/test_upload.py
- odoo/http.py 9 additions, 0 deletionsodoo/http.py
Loading