Skip to content

Commit afb472e

Browse files
fix(s3): check both 'Policy' and 'policy' field names in presigned POST
The AWS SDK sends the presigned POST policy field as 'Policy' (capital P), but the validation code was looking for 'policy' (lowercase). This caused policy condition validation to be silently skipped for all presigned POST uploads made via the AWS SDK. Now checks both 'Policy' and 'policy' for compatibility. Co-Authored-By: Matej Snuderl <ematej.snuderl@gmail.com>
1 parent e6943aa commit afb472e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/java/io/github/hectorvent/floci/services/s3/S3Controller.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,10 @@ private Response handlePresignedPost(String bucket, String contentType, byte[] b
15601560
}
15611561

15621562
// Validate policy conditions if present
1563-
String policy = fields.get("policy");
1563+
String policy = fields.get("Policy");
1564+
if (policy == null) {
1565+
policy = fields.get("policy");
1566+
}
15641567
if (policy != null && !policy.isEmpty()) {
15651568
validatePolicyConditions(policy, bucket, fields, fileData.length);
15661569
}

0 commit comments

Comments
 (0)