diff --git a/conn_test.go b/conn_test.go index 7d3c299..ab26840 100644 --- a/conn_test.go +++ b/conn_test.go @@ -193,7 +193,7 @@ func (mock *ftpMock) listen() { if cmdParts[1] == "multiline-dir" { mock.printfLine("250-File data\r\n Type=dir;Size=0; multiline-dir\r\n Modify=20201213202400; multiline-dir\r\n250 End") } else { - mock.printfLine("250-File data\r\n Type=file;Size=42;Modify=20201213202400; magic-file\r\n250 End") + mock.printfLine("250-File data\r\n Type=file;Size=42;Modify=20201213202400; magic-file\r\n \r\n250 End") } case "NLST": if mock.dataConn == nil { diff --git a/ftp.go b/ftp.go index bbc1799..9892882 100644 --- a/ftp.go +++ b/ftp.go @@ -766,6 +766,10 @@ func (c *ServerConn) GetEntry(path string) (entry *Entry, err error) { if len(l) > 0 && l[0] == ' ' { l = l[1:] } + // Some severs seem to send a blank line at the end which we ignore + if l == "" { + continue + } if e, err = parseNextRFC3659ListLine(l, c.options.location, e); err != nil { return nil, err }