Skip to content

Commit

Permalink
Truncate files if they exist prior to extraction from archive (#1245)
Browse files Browse the repository at this point in the history
Signed-off-by: Slavek Kabrda <[email protected]>
  • Loading branch information
bkabrda authored Aug 29, 2024
1 parent ed7b428 commit dedd490
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 dedd490

Please sign in to comment.