fix(auth): require tag read permission for object tag counts

Signed-off-by: Feng Ruohang <rh@vonng.com>
This commit is contained in:
Feng Ruohang
2026-11-12 07:49:47 +08:00
parent 7c0a99284f
commit c39605d4f8
4 changed files with 63 additions and 35 deletions
+2 -2
View File
@@ -134,8 +134,8 @@ func setObjectHeaders(ctx context.Context, w http.ResponseWriter, objInfo Object
w.Header().Set(xhttp.Expires, objInfo.Expires.UTC().Format(http.TimeFormat))
}
// Set tag count if object has tags
if len(objInfo.UserTags) > 0 {
// Both the count and the optional values require permission to read tags.
if opts.TaggingCount && len(objInfo.UserTags) > 0 {
tags, _ := tags.ParseObjectTags(objInfo.UserTags)
if tags != nil && tags.Count() > 0 {
w.Header()[xhttp.AmzTagCount] = []string{strconv.Itoa(tags.Count())}