mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-26 02:02:24 +01:00
fix (sftp): fix edge case on SFTP client
This commit is contained in:
parent
e3a9d09094
commit
18ad293d2e
1 changed files with 3 additions and 2 deletions
|
|
@ -172,11 +172,12 @@ func (b Sftp) Touch(path string) error {
|
|||
}
|
||||
|
||||
func (b Sftp) Save(path string, file io.Reader) error {
|
||||
remoteFile, err := b.SFTPClient.OpenFile(path, os.O_WRONLY|os.O_CREATE)
|
||||
remoteFile, err := b.SFTPClient.Create(path)
|
||||
if err != nil {
|
||||
return b.err(err)
|
||||
}
|
||||
_, err = remoteFile.ReadFrom(file)
|
||||
_, err = io.Copy(remoteFile, file)
|
||||
remoteFile.Close()
|
||||
return b.err(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue