This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 993b00e6b fix(s3): fix missing complete multipart upload headers
(#7327)
993b00e6b is described below
commit 993b00e6b59333c20273a61939644dc5b3e57fc9
Author: dentiny <[email protected]>
AuthorDate: Fri Mar 27 03:02:06 2026 -0700
fix(s3): fix missing complete multipart upload headers (#7327)
---
core/services/s3/src/core.rs | 9 +++++++++
core/services/s3/src/writer.rs | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/core/services/s3/src/core.rs b/core/services/s3/src/core.rs
index 30e763e96..643c95dc9 100644
--- a/core/services/s3/src/core.rs
+++ b/core/services/s3/src/core.rs
@@ -900,6 +900,7 @@ impl S3Core {
path: &str,
upload_id: &str,
parts: Vec<CompleteMultipartUploadRequestPart>,
+ args: &OpWrite,
) -> Result<Response<Buffer>> {
let p = build_abs_path(&self.root, path);
@@ -922,6 +923,14 @@ impl S3Core {
// Set content-type to `application/xml` to avoid mixed with form post.
req = req.header(CONTENT_TYPE, "application/xml");
+ // Set conditional write headers.
+ if let Some(if_match) = args.if_match() {
+ req = req.header(IF_MATCH, if_match);
+ }
+ if args.if_not_exists() {
+ req = req.header(IF_NONE_MATCH, "*");
+ }
+
// Set request payer header if enabled.
req = self.insert_request_payer_header(req);
diff --git a/core/services/s3/src/writer.rs b/core/services/s3/src/writer.rs
index a377130e8..67a6deb1a 100644
--- a/core/services/s3/src/writer.rs
+++ b/core/services/s3/src/writer.rs
@@ -180,7 +180,7 @@ impl oio::MultipartWrite for S3Writer {
let resp = self
.core
- .s3_complete_multipart_upload(&self.path, upload_id, parts)
+ .s3_complete_multipart_upload(&self.path, upload_id, parts,
&self.op)
.await?;
let status = resp.status();