From f686fc6ef454aead6095bba2dbc2289a97c123d0 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 16 Nov 2015 18:46:05 -0800 Subject: [PATCH] ls: handle cases of non-existant directories --- url.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/url.go b/url.go index f943657f..8e642d2e 100644 --- a/url.go +++ b/url.go @@ -87,12 +87,6 @@ func url2DirContent(urlStr string) (content *client.Content, err *probe.Error) { if err != nil { return nil, err.Trace(urlStr) } - if clnt.GetURL().Path == string(clnt.GetURL().Separator) || clnt.GetURL().Path == "." { - content := new(client.Content) - content.URL = clnt.GetURL() - content.Type = os.ModeDir - return content, nil - } isRecursive := false isIncomplete := false for entry := range clnt.List(isRecursive, isIncomplete) { @@ -106,5 +100,8 @@ func url2DirContent(urlStr string) (content *client.Content, err *probe.Error) { return content, nil } } - return nil, errDummy().Trace(urlStr) + content = new(client.Content) + content.URL = clnt.GetURL() + content.Type = os.ModeDir + return content, nil }