cozy / cozy-client-js

Javascript library to write Cozy applications
https://docs.cozy.io/en/cozy-client-js/README/
MIT License
11 stars 12 forks source link

feat: Send uploaded file size via querystring #311

Closed taratatach closed 3 years ago

taratatach commented 3 years ago

Some fetch implementations like the one used in the Cozy Desktop client (i.e. using Chromium's network stack) don't allow setting the Content-Length header when sending stream bodies. With this limitation, the remote cozy-stack cannot run size checks until the whole file has been uploaded. If the file is large and too large for the available space or the file size limit, the uploading client can spend quite some time uploading it to end up receiving an error response.

cozy-stack now allows passing the file size via the querystring parameter Size so those clients will get the benefits of early size checks.