Skip to content

Commit

Permalink
Truncate files if they exist prior to extraction from archive (sigsto…
Browse files Browse the repository at this point in the history
…re#1245)

Signed-off-by: Slavek Kabrda <[email protected]>
  • Loading branch information
bkabrda authored and bouskaJ committed Aug 30, 2024
1 parent 2656f8c commit 3b3b255
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func Uncompress(src io.Reader, dst string) error {
}
// Write out files
case tar.TypeReg:
fileToWrite, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, os.FileMode(header.Mode))
fileToWrite, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.FileMode(header.Mode))
if err != nil {
return err
}
Expand Down

0 comments on commit 3b3b255

Please sign in to comment.