create: check that downloaded URL is actually archive
My common mistake is to specify release URL, like
brew crate https://github.com/hugelgupf/p9/releases/tag/v0.3.0
which gives unpacking errors later. It should be archive instead
brew create https://github.com/hugelgupf/p9/archive/refs/tags/v0.3.0.tar.gz
Ideally we can try to autodetect the archive from release page,
but erroring out if downloaded file is HTML page should be handy
for early spotting other URL mistakes too.
This commit is contained in:
parent
ad75e9b337
commit
62753a5ec6
@ -82,7 +82,10 @@ module Homebrew
|
||||
r = Resource.new
|
||||
r.url(@url)
|
||||
r.owner = self
|
||||
@sha256 = r.fetch.sha256 if r.download_strategy == CurlDownloadStrategy
|
||||
filepath = r.fetch
|
||||
raise "Downloaded URL is not archive" if File.read(filepath, 100).strip.start_with?("<!DOCTYPE html>")
|
||||
|
||||
@sha256 = filepath.sha256
|
||||
end
|
||||
|
||||
if @github
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user