Skip to content

Commit

Permalink
Truncate files if they exist prior to extraction from archive
Browse files Browse the repository at this point in the history
Signed-off-by: Slavek Kabrda <[email protected]>
  • Loading branch information
bkabrda committed Aug 28, 2024
1 parent 8071236 commit 8759eaf
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 8759eaf

Please sign in to comment.