fix mc rb to accept bucket or alias as valid args (#2886)

Fixes: #2869
This commit is contained in:
poornas
2019-09-07 12:13:52 +05:30
committed by Nitish Tiwari
parent bc1c6bde1d
commit 9f75caef55
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -489,6 +489,9 @@ func (f *fsClient) Remove(isIncomplete, isRemoveBucket bool, contentCh <-chan *c
if os.IsPermission(err) {
// Ignore permission error.
errorCh <- probe.NewError(PathInsufficientPermission{Path: content.URL.Path})
} else if os.IsNotExist(err) && isRemoveBucket {
// ignore PathNotFound for dir removal.
return
} else {
errorCh <- probe.NewError(err)
return
+7
View File
@@ -21,6 +21,7 @@ import (
"context"
"crypto/tls"
"encoding/json"
"errors"
"hash/fnv"
"io"
"net"
@@ -884,6 +885,12 @@ func (c *s3Client) Remove(isIncomplete, isRemoveBucket bool, contentCh <-chan *c
go func() {
defer close(errorCh)
if isRemoveBucket {
if _, object := c.url2BucketAndObject(); object != "" {
errorCh <- probe.NewError(errors.New("cannot delete prefixes with `mc rb` command - Use `mc rm` instead"))
return
}
}
for content := range contentCh {
// Convert content.URL.Path to objectName for objectsCh.
bucket, objectName := c.splitPath(content.URL.Path)