gaul / s3proxy

Access other storage backends via the S3 API
Apache License 2.0
1.65k stars 220 forks source link

multipart upload with sha256 checksum not working #656

Open bitkid opened 1 week ago

bitkid commented 1 week ago

i create my parts for a CompleteMultipartUploadRequest like this

CompletedPart.builder().eTag(it.etag).partNumber(it.partNumber).checksumSHA256(it.sha256).build()

then i get the warning in the logs

2024-06-19 15:58:45.105 [S3Proxy-Jetty-163] WARN o.g.s.o.e.jetty.server.HttpChannel - handleException /scinteco-repong01/01026b95-149b-47fa-91a2-984b83b3ffb7/66a1d4fd-5840-40b6-ad9c-61f34a50ac64/6f532a25-05eb-4c3b-a85c-73f4fde84f4d com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "ChecksumSHA256" (class org.gaul.s3proxy.CompleteMultipartUploadRequest$Part), not marked as ignorable (2 known properties: "PartNumber", "ETag"]) at [Source: (org.gaul.shaded.org.eclipse.jetty.server.HttpInput); line: 1, column: 252] (through reference chain: org.gaul.s3proxy.CompleteMultipartUploadRequest["Part"]->java.util.ArrayList[0]->org.gaul.s3proxy.CompleteMultipartUploadRequest$Part["ChecksumSHA256"])

and an error like this software.amazon.awssdk.services.s3.model.S3Exception: null (Service: S3, Status Code: 500, Request ID: 4442587FB7D0A2F9)

if i remove .checksumSHA256(it.sha256) it works but it does not work when i use the real S3 .. i get the error message

software.amazon.awssdk.services.s3.model.S3Exception: The upload was created using a sha256 checksum. The complete request must include the checksum for each part. It was missing for part 1 in the request. (Service: S3, Status Code: 400, Request ID: WA1T3TAEBD0VBATD, Extended Request ID: l+XMg35OSD9bsZ1AbuHZWOcWW9BIUt1B2DOL8bNzz9yeSgtuFGbCdPn8jc+sVTt96bpuq1yne8NpuHrhVKbsBtFZMj0f8ttFJ7CnhgdaOAg=)

bitkid commented 1 week ago

as a workaround i added the class org.gaul.s3proxy.CompleteMultipartUploadRequest and added @JacksonXmlProperty(localName = "ChecksumSHA256") String sha; to the part