From 1889034b5e2e16e08ec6ce924ac428a69958fa9c Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Tue, 28 May 2024 10:49:52 +0800 Subject: [PATCH] feat: support tags for postPolicy Upload --- post-policy.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/post-policy.go b/post-policy.go index 3f4881e82c..6d42488e54 100644 --- a/post-policy.go +++ b/post-policy.go @@ -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 {