ls: ls should ignore error BucketNameEmpty.

This is a valid case of 'ls', without this change.

```
$ mc ls localhost
mc: <ERROR> Unable to stat ‘localhost’. Bucket name cannot be empty.
```

What we need to ideally see is if server is not available is
```
$ mc ls localhost
mc: <ERROR> Unable to list folder. Get http://localhost:9000/: dial tcp [::1]:9000: getsockopt: connection refused
```
This commit is contained in:
Harshavardhana
2016-04-21 17:10:16 -07:00
parent a094c50f5a
commit 783d29794a
+5
View File
@@ -96,6 +96,11 @@ func checkListSyntax(ctx *cli.Context) {
for _, url := range URLs {
_, _, err := url2Stat(url)
if err != nil && !isURLPrefixExists(url, isIncomplete) {
// Bucket name empty is a valid error for 'ls myminio',
// treat it as such.
if _, ok := err.ToGoError().(BucketNameEmpty); ok {
continue
}
fatalIf(err.Trace(url), "Unable to stat ‘"+url+"’.")
}
}