1
mirror of https://github.com/rclone/rclone synced 2024-12-26 18:23:45 +01:00

sftp: open files for update write only to fix AWS SFTP interop - fixes #3776

This commit is contained in:
Nick Craig-Wood 2019-12-02 17:28:50 +00:00
parent ef7ac088c0
commit db39adeb3e

View File

@ -1215,7 +1215,7 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
if err != nil { if err != nil {
return errors.Wrap(err, "Update") return errors.Wrap(err, "Update")
} }
file, err := c.sftpClient.Create(o.path()) file, err := c.sftpClient.OpenFile(o.path(), os.O_WRONLY|os.O_CREATE|os.O_TRUNC)
o.fs.putSftpConnection(&c, err) o.fs.putSftpConnection(&c, err)
if err != nil { if err != nil {
return errors.Wrap(err, "Update Create failed") return errors.Wrap(err, "Update Create failed")