Do not crash on invalid lines
This commit is contained in:
10
ftp.go
10
ftp.go
@@ -403,10 +403,12 @@ func parseDirListLine(line string) (*Entry, error) {
|
||||
|
||||
// Try various time formats that DIR might use, and stop when one works.
|
||||
for _, format := range dirTimeFormats {
|
||||
e.Time, err = time.Parse(format, line[:len(format)])
|
||||
if err == nil {
|
||||
line = line[len(format):]
|
||||
break
|
||||
if len(line) > len(format) {
|
||||
e.Time, err = time.Parse(format, line[:len(format)])
|
||||
if err == nil {
|
||||
line = line[len(format):]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user