Fix basename for extracting cask downloads.

This commit is contained in:
Markus Reiter 2020-12-21 15:43:25 +01:00
parent 993bf95877
commit 82c1e6fb0e
2 changed files with 11 additions and 3 deletions

View File

@ -52,6 +52,10 @@ module Cask
downloader.cached_location downloader.cached_location
end end
def basename
downloader.basename
end
def verify_download_integrity(fn) def verify_download_integrity(fn)
if @cask.sha256 == :no_check if @cask.sha256 == :no_check
opoo "No checksum defined for cask '#{@cask}', skipping verification." opoo "No checksum defined for cask '#{@cask}', skipping verification."

View File

@ -152,10 +152,14 @@ module Cask
s.freeze s.freeze
end end
sig { returns(Download) }
def downloader
@downloader ||= Download.new(@cask, quarantine: quarantine?)
end
sig { returns(Pathname) } sig { returns(Pathname) }
def download def download
@download ||= Download.new(@cask, quarantine: quarantine?) @download ||= downloader.fetch(verify_download_integrity: @verify_download_integrity)
.fetch(verify_download_integrity: @verify_download_integrity)
end end
def verify_has_sha def verify_has_sha
@ -180,7 +184,7 @@ module Cask
odebug "Using container class #{primary_container.class} for #{primary_container.path}" odebug "Using container class #{primary_container.class} for #{primary_container.path}"
basename = CGI.unescape(File.basename(@cask.url.path)) basename = downloader.basename
if nested_container = @cask.container&.nested if nested_container = @cask.container&.nested
Dir.mktmpdir do |tmpdir| Dir.mktmpdir do |tmpdir|