Skip to content

Commit

Permalink
feat: support tags for postPolicy Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jiuker committed May 28, 2024
1 parent 95db455 commit 1889034
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 @@ -152,6 +152,23 @@ func (p *PostPolicy) SetCondition(matchType, condition, value string) error {
return errInvalidArgument("Invalid condition in policy")
}

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

// SetContentType - Sets content-type of the object for this policy
// based upload.
func (p *PostPolicy) SetContentType(contentType string) error {
Expand Down

0 comments on commit 1889034

Please sign in to comment.