allow empty buckets listed with mc ls -r (#3476)

This commit is contained in:
Harshavardhana
2020-11-02 15:49:07 -08:00
committed by GitHub
parent 50bfa26724
commit 470ae1ee5f
4 changed files with 4 additions and 3 deletions
+1
View File
@@ -199,6 +199,7 @@ func mainAdminHeal(ctx *cli.Context) error {
fatalIf(err.Trace(clnt.GetURL().String()), "Unable to create client for URL ", aliasedURL)
return nil
}
for content := range clnt.List(globalContext, ListOptions{IsRecursive: false, ShowDir: DirNone}) {
if content.Err != nil {
fatalIf(content.Err.Trace(clnt.GetURL().String()), "Unable to heal bucket `"+bucket+"`.")
+1 -1
View File
@@ -249,7 +249,7 @@ func doFind(ctxCtx context.Context, ctx *findContext) error {
var prevKeyName string
// iterate over all content which is within the given directory
for content := range ctx.clnt.List(globalContext, ListOptions{IsRecursive: true, ShowDir: DirNone}) {
for content := range ctx.clnt.List(globalContext, ListOptions{IsRecursive: true, ShowDir: DirFirst}) {
if content.Err != nil {
switch content.Err.ToGoError().(type) {
// handle this specifically for filesystem related errors.
+1 -1
View File
@@ -195,7 +195,7 @@ func doList(ctx context.Context, clnt Client, isRecursive, isIncomplete bool, ti
TimeRef: timeRef,
WithOlderVersions: withOlderVersions || !timeRef.IsZero(),
WithDeleteMarkers: true,
ShowDir: DirNone,
ShowDir: DirFirst,
}) {
if content.Err != nil {
switch content.Err.ToGoError().(type) {
+1 -1
View File
@@ -226,7 +226,7 @@ func doTree(ctx context.Context, url string, timeRef time.Time, level int, leaf
return nil
}
for content := range clnt.List(ctx, ListOptions{IsRecursive: false, TimeRef: timeRef, ShowDir: DirNone}) {
for content := range clnt.List(ctx, ListOptions{IsRecursive: false, TimeRef: timeRef, ShowDir: DirFirst}) {
if content.Err != nil {
errorIf(content.Err.Trace(clnt.GetURL().String()), "Unable to tree.")
continue