From 9766ff1805c7d96c8376dad84ece14bfe16edd5a Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Sun, 29 May 2016 01:46:57 +0530 Subject: [PATCH] Append trailing slash to targetURL only if absent (#1731) --- ls-main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ls-main.go b/ls-main.go index 9a354b88..c31544ac 100644 --- a/ls-main.go +++ b/ls-main.go @@ -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+"’.") }