Skip to content
Permalink
Browse files

Allow overwriting existing file during backup-fetch

  • Loading branch information...
x4m authored and Tinsane committed Jan 4, 2019
1 parent 6628050 commit 56ac30138650147c33b68fe5b67b7fb7d630bc09
Showing with 1 addition and 4 deletions.
  1. +1 −4 internal/tar_interpreter.go
@@ -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)
}

0 comments on commit 56ac301

Please sign in to comment.
You can’t perform that action at this time.