Switch to UTF-8 after login

closes #72
This commit is contained in:
Julian Kornberger 2017-02-04 12:24:16 +01:00
parent a5c2cfe9ac
commit 47d41e8ddd

14
ftp.go
View File

@ -95,12 +95,6 @@ func DialTimeout(addr string, timeout time.Duration) (*ServerConn, error) {
return nil, err return nil, err
} }
err = c.setUTF8()
if err != nil {
c.Quit()
return nil, err
}
if _, mlstSupported := c.features["MLST"]; mlstSupported { if _, mlstSupported := c.features["MLST"]; mlstSupported {
c.mlstSupported = true c.mlstSupported = true
} }
@ -130,8 +124,12 @@ func (c *ServerConn) Login(user, password string) error {
} }
// Switch to binary mode // Switch to binary mode
_, _, err = c.cmd(StatusCommandOK, "TYPE I") if _, _, err = c.cmd(StatusCommandOK, "TYPE I"); err != nil {
if err != nil { return err
}
// Switch to UTF-8
if err := c.setUTF8(); err != nil {
return err return err
} }