Fix incorrect filename parsing

When the file creation year, file size and filename contains the same
substring the parsed filename should contains only the correct filename
This commit is contained in:
Svett Ralchev
2016-12-29 00:37:08 +00:00
parent 988909ab28
commit 08566066b1
2 changed files with 4 additions and 1 deletions

3
ftp.go
View File

@@ -4,6 +4,7 @@ package ftp
import (
"bufio"
"errors"
"fmt"
"io"
"net"
"net/textproto"
@@ -342,7 +343,7 @@ func parseLsListLineName(line string, fields []string, offset int) string {
return ""
}
match := fields[offset-1]
match := fmt.Sprintf(" %s ", fields[offset-1])
index := strings.Index(line, match)
if index == -1 {
return ""