branch: elpa/hyperdrive
commit b218ff9cc7c5c73c58f58d3325606f8cabbbfb42
Author: Adam Porter <[email protected]>
Commit: Joseph Turner <[email protected]>
Change: (h/install) Delete downloaded file if hash doesn't match
---
hyperdrive.el | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hyperdrive.el b/hyperdrive.el
index f448003a8f..0b3c26b842 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -1357,7 +1357,10 @@ If FORCEP, don't prompt for confirmation before
downloading."
(if (with-temp-buffer
(insert-file-contents-literally file-name)
(equal sha256 (secure-hash 'sha256 (current-buffer))))
+ ;; Hash matches: finish installation.
(then file-name)
+ ;; Hash doesn't match: delete file and try next source.
+ (delete-file file-file)
(h/message "Trying next source because hash comparison failed
from URL: %s"
url)
(try)))