mirror of
https://github.com/versity/versitygw.git
synced 2026-09-19 22:44:28 +00:00
fix: Sets limit to tag set count to 10 for PutObjectTagging and 50 for PutBucketTagging
Fixes #1204 Fixes #1205 Tag count in `PutBucketTagging` and `PutObjectTagging` is limited. `PutBucketTagging`: 50 `PutObjectTagging`: 10 Adds the changes to return errors respectively
This commit is contained in:
@@ -1225,6 +1225,19 @@ func (c S3ApiController) PutBucketActions(ctx *fiber.Ctx) error {
|
||||
})
|
||||
}
|
||||
|
||||
if len(bucketTagging.TagSet.Tags) > 50 {
|
||||
if c.debug {
|
||||
log.Printf("bucket tagging length exceeds 50: %v\n", len(bucketTagging.TagSet.Tags))
|
||||
}
|
||||
return SendResponse(ctx, s3err.GetAPIError(s3err.ErrBucketTaggingLimited),
|
||||
&MetaOpts{
|
||||
Logger: c.logger,
|
||||
MetricsMng: c.mm,
|
||||
Action: metrics.ActionPutBucketTagging,
|
||||
BucketOwner: parsedAcl.Owner,
|
||||
})
|
||||
}
|
||||
|
||||
tags := make(map[string]string, len(bucketTagging.TagSet.Tags))
|
||||
|
||||
for _, tag := range bucketTagging.TagSet.Tags {
|
||||
@@ -1863,6 +1876,19 @@ func (c S3ApiController) PutActions(ctx *fiber.Ctx) error {
|
||||
})
|
||||
}
|
||||
|
||||
if len(objTagging.TagSet.Tags) > 10 {
|
||||
if c.debug {
|
||||
log.Printf("bucket tagging length exceeds 10: %v\n", len(objTagging.TagSet.Tags))
|
||||
}
|
||||
return SendResponse(ctx, s3err.GetAPIError(s3err.ErrObjectTaggingLimited),
|
||||
&MetaOpts{
|
||||
Logger: c.logger,
|
||||
MetricsMng: c.mm,
|
||||
Action: metrics.ActionPutObjectTagging,
|
||||
BucketOwner: parsedAcl.Owner,
|
||||
})
|
||||
}
|
||||
|
||||
tags := make(map[string]string, len(objTagging.TagSet.Tags))
|
||||
|
||||
for _, tag := range objTagging.TagSet.Tags {
|
||||
|
||||
Reference in New Issue
Block a user