fix: rb command regression deleting bucket (#3337)

This commit is contained in:
Harshavardhana
2020-08-03 15:32:42 -07:00
committed by GitHub
parent 6f8859262c
commit 32c13f2977
2 changed files with 12 additions and 3 deletions
+6
View File
@@ -1564,6 +1564,12 @@ func (c *S3Client) snapshot(ctx context.Context, isRecursive bool, timeRef time.
go func() {
defer close(contentCh)
for objectVersion := range c.listVersions(ctx, bucket, object, isRecursive, timeRef, includeOlderVersions, withDeleteMarkers) {
if objectVersion.Err != nil {
contentCh <- &ClientContent{
Err: probe.NewError(objectVersion.Err),
}
continue
}
contentCh <- c.objectInfo2ClientContent(bucket, objectVersion)
}
}()
+6 -3
View File
@@ -62,10 +62,10 @@ FLAGS:
EXAMPLES:
1. Remove an empty bucket on Amazon S3 cloud storage
{{.Prompt}} {{.HelpName}} s3/mybucket
2. Remove a directory hierarchy.
{{.Prompt}} {{.HelpName}} /tmp/this/new/dir1
3. Remove bucket 'jazz-songs' and all its contents
{{.Prompt}} {{.HelpName}} --force s3/jazz-songs
@@ -235,7 +235,10 @@ func mainRemoveBucket(cliCtx *cli.Context) error {
}
listCtx, listCancel := context.WithCancel(ctx)
for range clnt.List(listCtx, opts) {
for obj := range clnt.List(listCtx, opts) {
if obj.Err != nil {
continue
}
isEmpty = false
break
}