From 3af607357642584d13710421b7adbad4205ca714 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 6 Jul 2022 09:53:33 -0700 Subject: [PATCH] no 'replicate status' without replication config (#15233) 'replicate status' shouldn't be displaying historic values unless replication config is present on the relevant bucket. --- cmd/bucket-replication-handlers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/bucket-replication-handlers.go b/cmd/bucket-replication-handlers.go index 9ee82fb45..d038870ce 100644 --- a/cmd/bucket-replication-handlers.go +++ b/cmd/bucket-replication-handlers.go @@ -202,6 +202,12 @@ func (api objectAPIHandlers) GetBucketReplicationMetricsHandler(w http.ResponseW writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } + + if _, _, err := globalBucketMetadataSys.GetReplicationConfig(ctx, bucket); err != nil { + writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) + return + } + var usageInfo BucketUsageInfo dataUsageInfo, err := loadDataUsageFromBackend(ctx, objectAPI) if err == nil && !dataUsageInfo.LastUpdate.IsZero() {