When performing a send_buffered request using a Payload providing no SizeHint, if the object size is a multiple of the buffer size, the request fails with a malformed "Content-Range" header.
Environment details
- Programming language:Rust
- OS:Linux
- Language runtime version: 1.90 (2024)
- Package version: 1.1.0
Steps to reproduce
You can find a reproducer code here : https://gist.github.com/dbrasseur-aneo/c2ee7e8ece49dd4fb82fea73a5f9f43c
- Create a Storage.write_object request
- Set the source as a stream with no size_hint (or a size_hint with no upper)
- use the send_buffered function to send the stream to an object
- If the object size is a multiple of the buffer size, a request is sent with a malformed "Content-Range" header, leading to the failure
Potential location of the issue
After doing some digging, the issue may stem from https://github.com/googleapis/google-cloud-rust/blob/main/src/storage/src/storage/perform_upload/buffered/progress.rs#L162 used here https://github.com/googleapis/google-cloud-rust/blob/main/src/storage/src/storage/perform_upload/buffered.rs#L120
When uploading the first buffer, it gives : "bytes 0-'buffsize-1'/*"
But on the last buffer it gives: "bytes 'objectsize'-'objectsize-1'/'objectsize'" (since n==0), which is invalid.
Thanks!
When performing a send_buffered request using a Payload providing no SizeHint, if the object size is a multiple of the buffer size, the request fails with a malformed "Content-Range" header.
Environment details
Steps to reproduce
You can find a reproducer code here : https://gist.github.com/dbrasseur-aneo/c2ee7e8ece49dd4fb82fea73a5f9f43c
Potential location of the issue
After doing some digging, the issue may stem from https://github.com/googleapis/google-cloud-rust/blob/main/src/storage/src/storage/perform_upload/buffered/progress.rs#L162 used here https://github.com/googleapis/google-cloud-rust/blob/main/src/storage/src/storage/perform_upload/buffered.rs#L120
When uploading the first buffer, it gives : "bytes 0-'buffsize-1'/*"
But on the last buffer it gives: "bytes 'objectsize'-'objectsize-1'/'objectsize'" (since n==0), which is invalid.
Thanks!