ls: list objects inside a directory when this latter is passed without a trailing separator (#1724)

This commit is contained in:
Anis Elleuch
2016-05-20 16:43:06 -07:00
committed by Harshavardhana
parent e5bc26c75a
commit 8b074767db
+9
View File
@@ -135,6 +135,15 @@ func mainList(ctx *cli.Context) {
clnt, err := newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target ‘"+targetURL+"’.")
st, err := clnt.Stat()
fatalIf(err.Trace(targetURL), "Unable to stat target ‘"+targetURL+"’.")
if st.Type.IsDir() {
targetURL = targetURL + string(clnt.GetURL().Separator)
clnt, err = newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target ‘"+targetURL+"’.")
}
err = doList(clnt, isRecursive, isIncomplete)
if err != nil {
errorIf(err.Trace(clnt.GetURL().String()), "Unable to list target ‘"+clnt.GetURL().String()+"’.")