This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs-object-store.git
The following commit(s) were added to refs/heads/main by this push:
new 668a876 Add content length to PUT GCP multipart complete (#257)
668a876 is described below
commit 668a87625b2e44486289c40546da5d47ca1456a9
Author: Joseph Koshakow <[email protected]>
AuthorDate: Mon Mar 24 14:01:16 2025 -0400
Add content length to PUT GCP multipart complete (#257)
* Add content length to PUT GCP multipart complete
This commit fixes the GCP mulipart complete implementation by adding
the Content-Length header to the PUT XML requests that happens when
the completed parts are empty. GCP is strict about setting the
Content-Length header on requests with empty bodies, so previously this
would result in a 411 error.
* Use put method
* Revert header change in put
* fixup
---
src/gcp/client.rs | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/gcp/client.rs b/src/gcp/client.rs
index 1cc7296..9a54dd7 100644
--- a/src/gcp/client.rs
+++ b/src/gcp/client.rs
@@ -514,13 +514,11 @@ impl GoogleCloudStorageClient {
completed_parts: Vec<PartId>,
) -> Result<PutResult> {
if completed_parts.is_empty() {
- // GCS doesn't allow empty multipart uploads
+ // GCS doesn't allow empty multipart uploads, so fallback to
regular upload.
+ self.multipart_cleanup(path, multipart_id).await?;
let result = self
- .request(Method::PUT, path)
- .idempotent(true)
- .do_put()
+ .put(path, PutPayload::new(), Default::default())
.await?;
- self.multipart_cleanup(path, multipart_id).await?;
return Ok(result);
}