From d45463ea416dbeea41dbb546abac76b678fd32e9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 16 May 2015 12:38:53 -0700 Subject: [PATCH] Fix consistency of ls output --- ls.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ls.go b/ls.go index cd423194..6fcc32b1 100644 --- a/ls.go +++ b/ls.go @@ -78,7 +78,12 @@ func doListRecursive(clnt client.Client, targetURL string) error { err = contentCh.Err break } - printContent(contentCh.Content.Time, contentCh.Content.Size, contentCh.Content.Name, contentCh.Content.Type) + // this special handling is necessary since we are sending back absolute paths with in ListRecursive() + // a user would not wish to see a URL just for recursive and not for regular List() + // + // To be consistent we have to filter them out + contentName := strings.TrimPrefix(contentCh.Content.Name, strings.TrimSuffix(targetURL, "/")+"/") + printContent(contentCh.Content.Time, contentCh.Content.Size, contentName, contentCh.Content.Type) } if err != nil { return iodine.New(err, map[string]string{"Target": targetURL})