From 6c1410f7f57cf539990ec6d9db0b4afea8a72393 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Sat, 15 Apr 2023 16:22:18 +0800 Subject: [PATCH] fix: Type of rejection for FIFO quota input (#17016) --- cmd/admin-bucket-handlers.go | 10 ---------- cmd/bucket-quota.go | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/cmd/admin-bucket-handlers.go b/cmd/admin-bucket-handlers.go index 94f8b0374..abc9dd9ac 100644 --- a/cmd/admin-bucket-handlers.go +++ b/cmd/admin-bucket-handlers.go @@ -85,11 +85,6 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r * return } - if quotaConfig.Type == "fifo" { - writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrInvalidRequest), r.URL) - return - } - updatedAt, err := globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, data) if err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) @@ -1032,11 +1027,6 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r * continue } - if quotaConfig.Type == "fifo" { - rpt.SetStatus(bucket, fileName, fmt.Errorf("Detected older 'fifo' quota config, 'fifo' feature is removed and not supported anymore")) - continue - } - updatedAt, err := globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, data) if err != nil { rpt.SetStatus(bucket, fileName, err) diff --git a/cmd/bucket-quota.go b/cmd/bucket-quota.go index 7a9372883..6be9e071b 100644 --- a/cmd/bucket-quota.go +++ b/cmd/bucket-quota.go @@ -82,7 +82,7 @@ func parseBucketQuota(bucket string, data []byte) (quotaCfg *madmin.BucketQuota, if !quotaCfg.IsValid() { if quotaCfg.Type == "fifo" { logger.LogIf(GlobalContext, errors.New("Detected older 'fifo' quota config, 'fifo' feature is removed and not supported anymore. Please clear your quota configs using 'mc admin bucket quota alias/bucket --clear' and use 'mc ilm add' for expiration of objects")) - return quotaCfg, nil + return quotaCfg, fmt.Errorf("invalid quota type 'fifo'") } return quotaCfg, fmt.Errorf("Invalid quota config %#v", quotaCfg) }