skip self on ReadDir

This commit is contained in:
Christoph Polcin 2014-10-23 13:38:49 +02:00
parent a13166c6af
commit a5b6eb39ff

View File

@ -71,8 +71,16 @@ func getProps(r *response, status string) *props {
func (c *Client) ReadDir(path string) ([]os.FileInfo, error) { func (c *Client) ReadDir(path string) ([]os.FileInfo, error) {
path = FixSlash(path) path = FixSlash(path)
files := make([]os.FileInfo, 0) files := make([]os.FileInfo, 0)
skipSelf := true
parse := func(resp interface{}) { parse := func(resp interface{}) {
r := resp.(*response) r := resp.(*response)
if skipSelf {
skipSelf = false
r.Props = nil
return
}
if p := getProps(r, "200"); p != nil { if p := getProps(r, "200"); p != nil {
f := new(File) f := new(File)
f.name = p.Name f.name = p.Name