ls: Add Stat call to determine bucket/directory (#2656)

This commit is contained in:
kannappanr
2019-01-23 17:17:35 -08:00
committed by GitHub
parent ede0911de2
commit a3132480db
+10
View File
@@ -130,6 +130,16 @@ func mainList(ctx *cli.Context) error {
clnt, err := newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
if !strings.HasSuffix(targetURL, string(clnt.GetURL().Separator)) {
var st *clientContent
st, err = clnt.Stat(isIncomplete, false, nil)
if err == nil && st.Type.IsDir() {
targetURL = targetURL + string(clnt.GetURL().Separator)
clnt, err = newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target `"+targetURL+"`.")
}
}
if e := doList(clnt, isRecursive, isIncomplete); e != nil {
cErr = e
}