Append trailing slash to targetURL only if absent (#1731)

This commit is contained in:
Krishnan Parthasarathi
2016-05-28 13:16:57 -07:00
committed by Harshavardhana
parent cc4227e3f2
commit 9766ff1805
+3 -1
View File
@@ -145,7 +145,9 @@ func mainList(ctx *cli.Context) {
fatalIf(err.Trace(targetURL), "Unable to initialize target ‘"+targetURL+"’.")
}
} else if st.Type.IsDir() {
targetURL = targetURL + string(clnt.GetURL().Separator)
if !strings.HasSuffix(targetURL, string(clnt.GetURL().Separator)) {
targetURL = targetURL + string(clnt.GetURL().Separator)
}
clnt, err = newClient(targetURL)
fatalIf(err.Trace(targetURL), "Unable to initialize target ‘"+targetURL+"’.")
}