Another fix for the line parser
This commit is contained in:
parent
107079411b
commit
1fc6b70adc
4
ftp.go
4
ftp.go
@ -347,6 +347,10 @@ func parseLsListLine(line string) (*Entry, error) {
|
|||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(fields) < 8 {
|
||||||
|
return nil, errUnsupportedListLine
|
||||||
|
}
|
||||||
|
|
||||||
if fields[1] == "0" {
|
if fields[1] == "0" {
|
||||||
e := &Entry{
|
e := &Entry{
|
||||||
Type: EntryTypeFile,
|
Type: EntryTypeFile,
|
||||||
|
@ -59,6 +59,7 @@ var listTestsFail = []unsupportedLine{
|
|||||||
{"modify=20150806235817;invalid;UNIX.owner=0; movies", "Unsupported LIST line"},
|
{"modify=20150806235817;invalid;UNIX.owner=0; movies", "Unsupported LIST line"},
|
||||||
{"Zrwxrwxrwx 1 root other 7 Jan 25 00:17 bin -> usr/bin", "Unknown entry type"},
|
{"Zrwxrwxrwx 1 root other 7 Jan 25 00:17 bin -> usr/bin", "Unknown entry type"},
|
||||||
{"total 1", "Unsupported LIST line"},
|
{"total 1", "Unsupported LIST line"},
|
||||||
|
{"", "Unsupported LIST line"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestParseValidListLine(t *testing.T) {
|
func TestParseValidListLine(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user