diff --git a/ftp.go b/ftp.go index 66dcf54..175b967 100644 --- a/ftp.go +++ b/ftp.go @@ -325,7 +325,10 @@ func parseRFC3659ListLine(line string) (*Entry, error) { } case "type": switch value { - case "dir", "cdir", "pdir": + case "cdir", "pdir": + // Discard current and parent dir + return nil, nil + case "dir": e.Type = EntryTypeFolder case "file": e.Type = EntryTypeFile @@ -541,7 +544,7 @@ func (c *ServerConn) List(path string) (entries []*Entry, err error) { for scanner.Scan() { line := scanner.Text() entry, err := parseListLine(line) - if err == nil { + if err == nil && entry != nil { entries = append(entries, entry) } }