Merge pull request #19621 from abitrolly/create-url-not-file
create: check that downloaded URL is actually archive
This commit is contained in:
commit
7b2ca65eac
@ -82,7 +82,13 @@ module Homebrew
|
|||||||
r = Resource.new
|
r = Resource.new
|
||||||
r.url(@url)
|
r.url(@url)
|
||||||
r.owner = self
|
r.owner = self
|
||||||
@sha256 = r.fetch.sha256 if r.download_strategy == CurlDownloadStrategy
|
filepath = r.fetch
|
||||||
|
html_doctype_prefix = "<!doctype html"
|
||||||
|
if File.read(filepath, html_doctype_prefix.length).downcase.start_with?(html_doctype_prefix)
|
||||||
|
raise "Downloaded URL is not archive"
|
||||||
|
end
|
||||||
|
|
||||||
|
@sha256 = filepath.sha256
|
||||||
end
|
end
|
||||||
|
|
||||||
if @github
|
if @github
|
||||||
|
Loading…
x
Reference in New Issue
Block a user