Skip to content

Commit

Permalink
Return error if no tags in bucket (#924)
Browse files Browse the repository at this point in the history
Closes #898.
  • Loading branch information
roman-khimov authored Feb 8, 2024
2 parents 90de859 + 7d0b0e3 commit aef5732
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/layer/tagging.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,18 @@ func (n *layer) GetBucketTagging(ctx context.Context, bktInfo *data.BucketInfo)
}

tags, err := n.treeService.GetBucketTagging(ctx, bktInfo)
if err != nil && !errorsStd.Is(err, ErrNodeNotFound) {
if err != nil {
if errorsStd.Is(err, ErrNodeNotFound) {
return nil, s3errors.GetAPIError(s3errors.ErrBucketTaggingNotFound)
}

return nil, err
}

if len(tags) == 0 {
return nil, s3errors.GetAPIError(s3errors.ErrBucketTaggingNotFound)
}

n.cache.PutTagging(owner, bucketTaggingCacheKey(bktInfo.CID), tags)

return tags, nil
Expand Down

0 comments on commit aef5732

Please sign in to comment.