Skip to content

Commit

Permalink
feat: add SetContentDisposition method for postPolicy Upload (#1982)
Browse files Browse the repository at this point in the history
  • Loading branch information
lianggx6 authored Jul 3, 2024
1 parent 4742469 commit 66ba593
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions post-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,23 @@ func (p *PostPolicy) SetContentTypeStartsWith(contentTypeStartsWith string) erro
return nil
}

// SetContentDisposition - Sets content-disposition of the object for this policy
func (p *PostPolicy) SetContentDisposition(contentDisposition string) error {
if strings.TrimSpace(contentDisposition) == "" || contentDisposition == "" {
return errInvalidArgument("No content disposition specified.")
}
policyCond := policyCondition{
matchType: "eq",
condition: "$Content-Disposition",
value: contentDisposition,
}
if err := p.addNewPolicy(policyCond); err != nil {
return err
}
p.formData["Content-Disposition"] = contentDisposition
return nil
}

// SetContentLengthRange - Set new min and max content length
// condition for all incoming uploads.
func (p *PostPolicy) SetContentLengthRange(min, max int64) error {
Expand Down

0 comments on commit 66ba593

Please sign in to comment.