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`.
This commit is contained in:
+2
-2
@@ -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--
|
||||
|
||||
Reference in New Issue
Block a user