Skip to content
This repository was archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Ensure file is empty before writing to it via SFTP
Browse files Browse the repository at this point in the history
  • Loading branch information
puffrfish committed May 22, 2017
1 parent fc1c40b commit 5fa65e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sftp/requestprefix.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (rp requestPrefix) Fileread(request sftp.Request) (io.ReaderAt, error) {
}

func (rp requestPrefix) Filewrite(request sftp.Request) (io.WriterAt, error) {
file, err := rp.getFile(request.Filepath, os.O_WRONLY | os.O_APPEND | os.O_CREATE, 0644)
file, err := rp.getFile(request.Filepath, os.O_WRONLY | os.O_TRUNC | os.O_CREATE, 0644)
return file, err
}

Expand Down

0 comments on commit 5fa65e3

Please sign in to comment.