Skip to content

fix(ci): verify downloads before replacing existing files - #1044

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
hiyouwhatsapp:fix/verify-download-before-replace-1019
Oct 25, 2026
Merged

LunaStev merged 1 commit into
wavefnd:masterfrom
hiyouwhatsapp:fix/verify-download-before-replace-1019

Conversation

@hiyouwhatsapp

Copy link
Copy Markdown
Contributor

Fixes #1019

download() was writing straight into the destination, so a bad checksum or interrupted curl could leave an existing file overwritten.

This downloads into a temporary directory beside the destination and checks the SHA-256 before replacing anything. The curl retry and timeout settings stay as they were. If the download, verification or final replacement fails, the old file stays in place and the temporary copy is cleaned up.

Added eight regression cases with and without an existing destination. They cover successful downloads, checksum mismatches, interrupted writes and replacement failures.

Testing: All eight cases pass in an isolated Python harness using the changed download function and fail against the original function. I haven't run the full repository test suite locally. CI still needs to run.

Download into a temporary directory beside the destination, check the
SHA-256 digest, and replace the destination only after verification.
Keep old files intact when curl, verification, or activation fails.

Add eight regression cases covering those paths with and without a
previous destination.

Fixes wavefnd#1019

Signed-off-by: hiyouwhatsapp <[email protected]>
@LunaStev
LunaStev merged commit 67e42d0 into wavefnd:master Oct 25, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve an existing download destination until checksum verification succeeds

2 participants