S3Mock icon indicating copy to clipboard operation
S3Mock copied to clipboard

Wrong error code for CompleteMultipartUpload when write condition fails

Open findepi opened this issue 3 months ago • 3 comments

In Trino project we have a test using S3Mock.

We're upgrading to use S3Mock 4.10.0 to benefit from its support for S3 conditional writes.

We currently have two code paths for conditional writes with If-None-Match: *

  • via PutObject request
  • via multi-part upload where write condition is verified in CompleteMultipartUpload request

We noticed that in the second code path, when running with S3Mock 4.10.0, we get Status Code: 304 rather than 412 error code.

findepi avatar Nov 21 '25 09:11 findepi

Did you test this against AWS S3? We have a few ITs to verify the current behaviour, and those passed against S3 as well (I validate all tests roughly once per year against S3) https://github.com/search?q=repo%3Aadobe%2FS3Mock%20if-none-match&type=code

afranken avatar Nov 21 '25 15:11 afranken

Yes, AFAICT same test passed against AWS S3, Minio, LocalStack and Moto

findepi avatar Nov 21 '25 20:11 findepi

have you had time to test this against S3 yet?

afranken avatar Dec 03 '25 12:12 afranken

just wrote a new test that passes against S3 APIs. S3Mock 4.x returns a 304 where it should return a 412 on CompleteMultipartRequests when the If-None-Match condition is true.

I just pushed a fix that will be released with the first 5.x release.

afranken avatar Dec 16 '25 17:12 afranken