Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/gcp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,13 @@ impl GoogleCloudStorageClient {
extensions,
} = opts;

let builder = self
.request(Method::PUT, path)
let builder = self.request(Method::PUT, path);
let builder = if payload.content_length() == 0 {
builder.header(&CONTENT_LENGTH, "0")
} else {
builder
};
let builder = builder
Copy link
Contributor

@tustvold tustvold Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is unnecessary, with_payload already handles this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah got it, I just reverted this change.

.with_payload(payload)
.with_attributes(attributes)
.with_extensions(extensions);
Expand Down Expand Up @@ -516,10 +521,7 @@ impl GoogleCloudStorageClient {
if completed_parts.is_empty() {
// GCS doesn't allow empty multipart uploads
let result = self
.request(Method::PUT, path)
.header(&CONTENT_LENGTH, "0")
.idempotent(true)
.do_put()
.put(path, PutPayload::new(), Default::default())
.await?;
self.multipart_cleanup(path, multipart_id).await?;
return Ok(result);
Expand Down