Skip to content

Malformed header in ResumableUpload when ObjectSize is multiple of Buffer size and no size hint is provided #3608

@dbrasseur-aneo

Description

@dbrasseur-aneo

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

  1. Create a Storage.write_object request
  2. Set the source as a stream with no size_hint (or a size_hint with no upper)
  3. use the send_buffered function to send the stream to an object
  4. 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!

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions