Skip to content

Commit

Permalink
Allow overwriting existing file during backup-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
x4m authored and Tinsane committed Jan 9, 2019
1 parent 6628050 commit 56ac301
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions internal/tar_interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ func (tarInterpreter *FileTarInterpreter) unwrapRegularFile(fileReader io.Reader
if err != nil {
return errors.Wrap(err, "Interpret: failed to create all directories")
}
file, err := os.OpenFile(targetPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0666)
if os.IsExist(err) {
return errors.Wrap(err, "file have to not exist till this moment")
}
file, err := os.OpenFile(targetPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
if err != nil {
return errors.Wrapf(err, "failed to create new file: '%s'", targetPath)
}
Expand Down

0 comments on commit 56ac301

Please sign in to comment.