From 23e1d34d64a933163694877b63b92645964a66ee Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sun, 25 Oct 2015 13:17:35 -0700 Subject: [PATCH] Construct url properly, use filepath.Join only for paths fixes #1215 --- rm-main.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rm-main.go b/rm-main.go index 93712695..3b6a4bdf 100644 --- a/rm-main.go +++ b/rm-main.go @@ -116,21 +116,22 @@ func rmSingle(url string) { } func rmAll(url string) { - urlPartial1 := url2Dir(url) out, err := rmList(url) if err != nil { errorIf(err.Trace(), "Unable to List "+url+".") return } - for urlPartial2 := range out { - urlFull := filepath.Join(urlPartial1, urlPartial2) - newclnt, e := url2Client(urlFull) + urlDir := url2Dir(url) + for urlPartial := range out { + newURL := client.NewURL(urlDir) + newURL.Path = filepath.Join(newURL.Path, urlPartial) + newclnt, e := url2Client(newURL.String()) if e != nil { - errorIf(e, "Unable to create client object : "+urlFull+".") + errorIf(e, "Unable to create client object : "+newURL.String()+".") continue } err = newclnt.Remove(false) - errorIf(err, "Unable to remove : "+urlFull+".") + errorIf(err, "Unable to remove : "+newURL.String()+".") } }