diff options
author | Pacien TRAN-GIRARD | 2012-09-21 23:46:43 +0200 |
---|---|---|
committer | Pacien | 2015-12-07 22:48:25 +0100 |
commit | 132b1748b3ad1b6ee5486348ed904c75c9c6b2d3 (patch) | |
tree | ebe5e3e5479c33b001290c378236bdd84332b1fd /src | |
parent | 81040ae6bab3b16f36b8f9d6d90df088159637b5 (diff) | |
download | ninja-go-local-cloud-132b1748b3ad1b6ee5486348ed904c75c9c6b2d3.tar.gz |
Fix directory content listing weird behavior.
Diffstat (limited to 'src')
-rw-r--r-- | src/ninjacloud.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/ninjacloud.go b/src/ninjacloud.go index c3e5322..0915e40 100644 --- a/src/ninjacloud.go +++ b/src/ninjacloud.go | |||
@@ -233,7 +233,6 @@ func listDir(path string, recursive bool, filter []string, returnType string) (l | |||
233 | modTime := strconv.FormatInt(d.ModTime().UnixNano(), 10) | 233 | modTime := strconv.FormatInt(d.ModTime().UnixNano(), 10) |
234 | modTime = modTime[:len(modTime)-6] | 234 | modTime = modTime[:len(modTime)-6] |
235 | uri := filepath.Clean(path + "/" + d.Name()) | 235 | uri := filepath.Clean(path + "/" + d.Name()) |
236 | list = append(list, element{}) | ||
237 | e.Type = "directory" | 236 | e.Type = "directory" |
238 | e.Name = d.Name() | 237 | e.Name = d.Name() |
239 | e.Uri = filepath.Clean(drivePrefix + uri) | 238 | e.Uri = filepath.Clean(drivePrefix + uri) |
@@ -249,11 +248,7 @@ func listDir(path string, recursive bool, filter []string, returnType string) (l | |||
249 | } else { | 248 | } else { |
250 | e.Children = nil | 249 | e.Children = nil |
251 | } | 250 | } |
252 | if cap(list) > 1 { | 251 | list = append(list, e) |
253 | list = append(list, e) | ||
254 | } else { | ||
255 | list[0] = e | ||
256 | } | ||
257 | } else if !d.IsDir() && returnFiles { | 252 | } else if !d.IsDir() && returnFiles { |
258 | ext := filepath.Ext(d.Name()) | 253 | ext := filepath.Ext(d.Name()) |
259 | if ext != "" { | 254 | if ext != "" { |