mirror of
https://github.com/minio/minio.git
synced 2026-05-28 04:03:23 -04:00
Merge c98f8695f5 into 7aac2a2c5b
This commit is contained in:
commit
4edceaee93
1 changed files with 15 additions and 7 deletions
|
|
@ -82,10 +82,21 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *
|
|||
return
|
||||
}
|
||||
|
||||
updatedAt, err := globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, data)
|
||||
if err != nil {
|
||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||
return
|
||||
var updatedAt time.Time
|
||||
// Remove the bucket quota configuration when the quota type is not set(from: mc quota clear alias/bucket).
|
||||
if quotaConfig.Size == 0 && quotaConfig.Quota == 0 {
|
||||
updatedAt, err = globalBucketMetadataSys.Delete(ctx, bucket, bucketQuotaConfigFile)
|
||||
if err != nil {
|
||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||
return
|
||||
}
|
||||
data = nil
|
||||
} else {
|
||||
updatedAt, err = globalBucketMetadataSys.Update(ctx, bucket, bucketQuotaConfigFile, data)
|
||||
if err != nil {
|
||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
bucketMeta := madmin.SRBucketMeta{
|
||||
|
|
@ -94,9 +105,6 @@ func (a adminAPIHandlers) PutBucketQuotaConfigHandler(w http.ResponseWriter, r *
|
|||
Quota: data,
|
||||
UpdatedAt: updatedAt,
|
||||
}
|
||||
if quotaConfig.Size == 0 && quotaConfig.Quota == 0 {
|
||||
bucketMeta.Quota = nil
|
||||
}
|
||||
|
||||
// Call site replication hook.
|
||||
replLogIf(ctx, globalSiteReplicationSys.BucketMetaHook(ctx, bucketMeta))
|
||||
|
|
|
|||
Loading…
Reference in a new issue