Skip to content

Commit

Permalink
Allow empty contentTypeStartsWith in PostPolicy
Browse files Browse the repository at this point in the history
  • Loading branch information
skirsten committed Oct 17, 2022
1 parent 7d71d94 commit 2feee97
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
4 changes: 0 additions & 4 deletions functional_tests.go
Expand Up @@ -4216,10 +4216,6 @@ func testPresignedPostPolicy() {
logError(testName, function, args, startTime, "", "SetContentType did not fail for invalid conditions", err)
return
}
if err := policy.SetContentTypeStartsWith(""); err == nil {
logError(testName, function, args, startTime, "", "SetContentTypeStartsWith did not fail for invalid conditions", err)
return
}
if err := policy.SetContentLengthRange(1024*1024, 1024); err == nil {
logError(testName, function, args, startTime, "", "SetContentLengthRange did not fail for invalid conditions", err)
return
Expand Down
4 changes: 1 addition & 3 deletions post-policy.go
Expand Up @@ -171,10 +171,8 @@ func (p *PostPolicy) SetContentType(contentType string) error {

// SetContentTypeStartsWith - Sets what content-type of the object for this policy
// based upload can start with.
// If "" is provided it allows all content-types.
func (p *PostPolicy) SetContentTypeStartsWith(contentTypeStartsWith string) error {
if strings.TrimSpace(contentTypeStartsWith) == "" || contentTypeStartsWith == "" {
return errInvalidArgument("No content type specified.")
}
policyCond := policyCondition{
matchType: "starts-with",
condition: "$Content-Type",
Expand Down

0 comments on commit 2feee97

Please sign in to comment.