Skip to content

Commit

Permalink
Allow empty contentTypeStartsWith in PostPolicy (#1710)
Browse files Browse the repository at this point in the history
  • Loading branch information
skirsten authored Oct 21, 2022
1 parent c6319be commit 4acfae7
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 4acfae7

Please sign in to comment.