From abd81afa85ec142b628a171093260b9553dd7812 Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Tue, 25 Nov 2025 17:00:47 +0530 Subject: [PATCH] fix complete_multipart_upload() to support SSE-C Signed-off-by: Bala.FA --- minio/api.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/minio/api.py b/minio/api.py index 285920ef..b7424cda 100644 --- a/minio/api.py +++ b/minio/api.py @@ -1696,6 +1696,7 @@ def compose_object( size -= length result = self._complete_multipart_upload( bucket_name, object_name, upload_id, total_parts, + sse if isinstance(sse, SseCustomerKey) else None, ) return ObjectWriteResult( cast(str, result.bucket_name), @@ -1732,6 +1733,7 @@ def _complete_multipart_upload( object_name: str, upload_id: str, parts: list[Part], + ssec: Optional[SseCustomerKey] = None, ) -> CompleteMultipartUploadResult: """Execute CompleteMultipartUpload S3 API.""" element = Element("CompleteMultipartUpload") @@ -1740,15 +1742,18 @@ def _complete_multipart_upload( SubElement(tag, "PartNumber", str(part.part_number)) SubElement(tag, "ETag", '"' + part.etag + '"') body = getbytes(element) + headers: DictType = { + "Content-Type": 'application/xml', + "Content-MD5": cast(str, md5sum_hash(body)), + } + if ssec: + headers.update(ssec.headers()) response = self._execute( "POST", bucket_name, object_name, body=body, - headers={ - "Content-Type": 'application/xml', - "Content-MD5": cast(str, md5sum_hash(body)), - }, + headers=headers, query_params={'uploadId': upload_id}, ) return CompleteMultipartUploadResult(response) @@ -1992,6 +1997,7 @@ def put_object( upload_result = self._complete_multipart_upload( bucket_name, object_name, cast(str, upload_id), parts, + sse if isinstance(sse, SseCustomerKey) else None, ) return ObjectWriteResult( cast(str, upload_result.bucket_name),