Content Sureness
build-binaries / build-binaries (pull_request) Successful in 2m16s
test-image / build-image (pull_request) Successful in 48s
test / test (pull_request) Successful in 1m26s

This commit is contained in:
2026-06-20 09:44:44 +02:00
parent cdbbba3181
commit 3b23910055
4 changed files with 45 additions and 2 deletions
+5
View File
@@ -425,6 +425,11 @@ func writeResourceData(w io.Writer, resource Resource) error {
}
defer file.Close()
// The hash is computed while streaming into w, so size/SHA mismatches are
// only detected AFTER the (bad) bytes have already been written. A non-nil
// return therefore means w holds partially-written, unverified output; the
// caller must discard it. writeHAKArchive does this by writing to a temp file
// and removing it on any Write error rather than renaming it into place.
hash := sha256.New()
written, err := io.Copy(io.MultiWriter(w, hash), file)
if err != nil {