mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(s3): return XML error responses for presigned POST failures (#327)
Presigned POST errors were returned as JSON via AwsExceptionMapper. Real AWS S3 returns XML for these. Wrap handlePresignedPost to convert AwsException to XML via xmlErrorResponse(). Adds integration test asserting the exact XML wire format.
This commit is contained in:
1 parent
3b6b5fb687
commit
51bde88f2f
2 files changed
+52
No files matched your search
@@ -1590,6 +1590,16 @@ public class S3Controller {
|
||||
}
|
||||
|
||||
private Response handlePresignedPost(String bucket, String contentType, byte[] body) {
|
||||
try {
|
||||
return doHandlePresignedPost(bucket, contentType, body);
|
||||
} catch (AwsException e) {
|
||||
// Presigned POST errors must be returned as XML (matching LocalStack/AWS),
|
||||
// not JSON which is what the global AwsExceptionMapper would produce.
|
||||
return xmlErrorResponse(e);
|
||||
}
|
||||
}
|
||||
|
||||
private Response doHandlePresignedPost(String bucket, String contentType, byte[] body) {
|
||||
String boundary = extractBoundary(contentType);
|
||||
if (boundary == null) {
|
||||
throw new AwsException("InvalidArgument",
|
||||
|
||||
Reference in new issue
Block a user