SIGN IN SIGN UP
Homebrew / brew UNCLAIMED

🍺 The missing package manager for macOS (or Linux)

0 0 185 Ruby

exceptions: hint when a download is HTML, not a binary

When a download URL silently returns an HTML page (a bot-protection
challenge such as Anubis or Cloudflare, a rate-limit page, or an error
page served as `text/html`) instead of the expected binary artifact,
`ChecksumMismatchError` was reported with no clue that no real download
happened. Users were steered toward filing a stale-checksum PR.

Detect HTML in the first 512 bytes of the file and append a dedicated
hint to the existing checksum-mismatch message, including a copy-pasteable
`rm "$(brew --cache)/..."` command for retrying. The original error path
is unchanged for non-HTML downloads.

The same code path is shared by cask, formula, bottle and resource
downloads, so all of them benefit.

Discussion: https://github.com/orgs/Homebrew/discussions/6837
J
Jari Mustonen committed
43a488e8a98f3f9eba4ab5dd26bb988e47a1d848
Parent: af5efa3