fix(s3): return x-amz-version-id from presigned POST (#2608)

A presigned POST to a versioning-enabled bucket creates a new version but the
response omits x-amz-version-id, so the caller cannot discover it. A browser
upload has no other channel — there is no SDK response to read — which breaks
the common direct-to-S3 pattern where the browser uploads, reads the version
from the response, and reports it back to the application.

The handler already has the S3Object returned by putObject; it simply never
read getVersionId(). Every other write path in S3Controller sets the header
behind the same null guard.

Fixes #2607
This commit is contained in:
Ricky Rattlesnake authored and GitHub committed 2026-08-28 08:55:07 -04:00
1 parent e471946f44
commit 066e6c904b
2 files changed
+54 -3

No files matched your search

@@ -2711,10 +2711,13 @@ public class S3Controller {
.elem("ETag", obj.getETag())
.end("PostResponse")
.build();
return Response.status(204)
var response = Response.status(204)
.header("ETag", obj.getETag())
.header("Location", bucket + "/" + key)
.build();
.header("Location", bucket + "/" + key);
if (obj.getVersionId() != null) {
response.header("x-amz-version-id", obj.getVersionId());
}
return response.build();
}
private void validatePolicyConditions(String policyBase64, String bucket,