Merge pull request #219 from ivandeex/master

trim trailing whitespace from the list commands
This commit is contained in:
Julien Laffaye
2021-03-02 14:57:56 -05:00
committed by GitHub
3 changed files with 31 additions and 2 deletions

12
ftp.go
View File

@@ -539,7 +539,11 @@ func (c *ServerConn) cmdDataConnFrom(offset uint64, format string, args ...inter
// NameList issues an NLST FTP command.
func (c *ServerConn) NameList(path string) (entries []string, err error) {
conn, err := c.cmdDataConnFrom(0, "NLST %s", path)
space := " "
if path == "" {
space = ""
}
conn, err := c.cmdDataConnFrom(0, "NLST%s%s", space, path)
if err != nil {
return nil, err
}
@@ -570,7 +574,11 @@ func (c *ServerConn) List(path string) (entries []*Entry, err error) {
parser = parseListLine
}
conn, err := c.cmdDataConnFrom(0, "%s %s", cmd, path)
space := " "
if path == "" {
space = ""
}
conn, err := c.cmdDataConnFrom(0, "%s%s%s", cmd, space, path)
if err != nil {
return nil, err
}