Merge pull request #199 from ncw/fix-198
Fix Stor() no longer reporting errors from the io.Reader passed in
This commit is contained in:
commit
43afc84ae3
14
ftp.go
14
ftp.go
@ -662,10 +662,13 @@ func (c *ServerConn) StorFrom(path string, r io.Reader, offset uint64) error {
|
||||
// the response and we cannot use the connection to send other commands.
|
||||
// So we don't check io.Copy error and we return the error from
|
||||
// ReadResponse so the user can see the real error
|
||||
io.Copy(conn, r)
|
||||
_, err = io.Copy(conn, r)
|
||||
conn.Close()
|
||||
|
||||
_, _, err = c.conn.ReadResponse(StatusClosingDataConnection)
|
||||
_, _, respErr := c.conn.ReadResponse(StatusClosingDataConnection)
|
||||
if respErr != nil {
|
||||
err = respErr
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@ -681,10 +684,13 @@ func (c *ServerConn) Append(path string, r io.Reader) error {
|
||||
}
|
||||
|
||||
// see the comment for StorFrom above
|
||||
io.Copy(conn, r)
|
||||
_, err = io.Copy(conn, r)
|
||||
conn.Close()
|
||||
|
||||
_, _, err = c.conn.ReadResponse(StatusClosingDataConnection)
|
||||
_, _, respErr := c.conn.ReadResponse(StatusClosingDataConnection)
|
||||
if respErr != nil {
|
||||
err = respErr
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user