From 12012eafad3af6e6b59e287234c3d524ff07abe0 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 22 Dec 2021 08:21:52 -0800 Subject: [PATCH] du: Fix double counting of objects (#3901) `mc du play` would count objects twice since it was doing a recursive listing AND travering into folders. Compare total to `mc du play --depth=2` and `mc du play --recursive`. --- cmd/du-main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/du-main.go b/cmd/du-main.go index 02b110ce..9281521e 100644 --- a/cmd/du-main.go +++ b/cmd/du-main.go @@ -24,7 +24,7 @@ import ( "strings" "time" - humanize "github.com/dustin/go-humanize" + "github.com/dustin/go-humanize" "github.com/fatih/color" "github.com/minio/cli" json "github.com/minio/colorjson" @@ -151,7 +151,7 @@ func du(ctx context.Context, urlStr string, timeRef time.Time, withVersions bool continue } - if content.Type.IsDir() { + if content.Type.IsDir() && !recursive { depth := depth if depth > 0 { depth--