Set the size of the entry in List()
This commit is contained in:
12
ftp.go
12
ftp.go
@@ -2,13 +2,13 @@ package ftp
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"net/textproto"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type EntryType int
|
||||
@@ -154,6 +154,14 @@ func parseListLine(line string) (*Entry, error) {
|
||||
return nil, errors.New("Unknown entry type")
|
||||
}
|
||||
|
||||
if e.Type == EntryTypeFile {
|
||||
size, err := strconv.ParseUint(fields[4], 10, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e.Size = size
|
||||
}
|
||||
|
||||
e.Name = strings.Join(fields[8:], " ")
|
||||
return e, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user