From 14fe8ecb5820e11ebbcea15d0c2f92b7a1e6fc0b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 22 Aug 2021 16:46:45 -0700 Subject: [PATCH] fix: decodeDirObject in prefix usage function (#13026) prefixes at top level create such as ``` ~ mc mb alias/bucket/prefix ``` The prefix/ incorrect appears as prefix__XL_DIR__/ in the accountInfo output, make sure to trim '__XL_DIR__' --- cmd/data-usage.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/data-usage.go b/cmd/data-usage.go index 6776919dc..735879714 100644 --- a/cmd/data-usage.go +++ b/cmd/data-usage.go @@ -84,7 +84,8 @@ func loadPrefixUsageFromBackend(ctx context.Context, objAPI ObjectLayer, bucket } for id, usageInfo := range cache.flattenChildrens(*root) { - prefix := strings.TrimPrefix(id, bucket+slashSeparator) + prefix := decodeDirObject(strings.TrimPrefix(id, bucket+slashSeparator)) + // decodeDirObject to avoid any __XL_DIR__ objects m[prefix] += uint64(usageInfo.Size) } }