mirror of
https://github.com/minio/minio.git
synced 2025-10-28 23:35:01 -04:00
fix: allow trailing slash in AWS S3 POST policies (#21612)
This commit is contained in:
parent
ba3c0fd1c7
commit
1b8ac0af9f
@ -75,7 +75,7 @@ func parseCredentialHeader(credElement string, region string, stype serviceType)
|
||||
if creds[0] != "Credential" {
|
||||
return ch, ErrMissingCredTag
|
||||
}
|
||||
credElements := strings.Split(strings.TrimSpace(creds[1]), SlashSeparator)
|
||||
credElements := strings.Split(strings.TrimRight(strings.TrimSpace(creds[1]), SlashSeparator), SlashSeparator)
|
||||
if len(credElements) < 5 {
|
||||
return ch, ErrCredMalformed
|
||||
}
|
||||
|
||||
@ -236,6 +236,25 @@ func TestParseCredentialHeader(t *testing.T) {
|
||||
"aws4_request"),
|
||||
expectedErrCode: ErrNone,
|
||||
},
|
||||
// Test Case - 12.
|
||||
// Test case with right inputs but trailing `/`. Expected to return a valid CredentialHeader.
|
||||
// "aws4_request" is the valid request version.
|
||||
{
|
||||
inputCredentialStr: generateCredentialStr(
|
||||
"Z7IXGOO6BZ0REAN1Q26I",
|
||||
sampleTimeStr,
|
||||
"us-west-1",
|
||||
"s3",
|
||||
"aws4_request/"),
|
||||
expectedCredentials: generateCredentials(
|
||||
t,
|
||||
"Z7IXGOO6BZ0REAN1Q26I",
|
||||
sampleTimeStr,
|
||||
"us-west-1",
|
||||
"s3",
|
||||
"aws4_request"),
|
||||
expectedErrCode: ErrNone,
|
||||
},
|
||||
}
|
||||
|
||||
for i, testCase := range testCases {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user