fix(cli): trucate file before untar (#1644)

This commit is contained in:
dkeven 2025-07-30 13:52:30 +08:00 committed by GitHub
parent 604b2191ce
commit c05f82c4bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -344,7 +344,7 @@ func Untar(src, dst string) error {
}
}
file, err := os.OpenFile(dstPath, os.O_CREATE|os.O_RDWR, os.FileMode(hdr.Mode))
file, err := os.OpenFile(dstPath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.FileMode(hdr.Mode))
if err != nil {
return err
}