vendor: update github.com/jlaffaye/ftp

This commit is contained in:
Gary Kim 2019-06-25 21:45:30 +08:00 committed by Nick Craig-Wood
parent 4e64ee38e2
commit 08bf8faa2f
5 changed files with 19 additions and 8 deletions

View file

@ -59,10 +59,11 @@ type dialOptions struct {
// Entry describes a file and is returned by List().
type Entry struct {
Name string
Type EntryType
Size uint64
Time time.Time
Name string
Target string // target of symbolic link
Type EntryType
Size uint64
Time time.Time
}
// Response represents a data-connection

View file

@ -73,8 +73,10 @@ func parseRFC3659ListLine(line string, now time.Time, loc *time.Location) (*Entr
// the UNIX ls command.
func parseLsListLine(line string, now time.Time, loc *time.Location) (*Entry, error) {
// Has the first field a length of 10 bytes?
if strings.IndexByte(line, ' ') != 10 {
// Has the first field a length of exactly 10 bytes
// - or 10 bytes with an additional '+' character for indicating ACLs?
// If not, return.
if i := strings.IndexByte(line, ' '); !(i == 10 || (i == 11 && line[10] == '+')) {
return nil, errUnsupportedListLine
}
@ -133,6 +135,12 @@ func parseLsListLine(line string, now time.Time, loc *time.Location) (*Entry, er
e.Type = EntryTypeFolder
case 'l':
e.Type = EntryTypeLink
// Split link name and target
if i := strings.Index(e.Name, " -> "); i > 0 {
e.Target = e.Name[i+4:]
e.Name = e.Name[:i]
}
default:
return nil, errUnknownListEntryType
}