Fix :svn download errors with :latest casks

This commit is contained in:
apainintheneck 2022-05-31 10:44:34 -07:00
parent 4054728030
commit 6f06236bca
2 changed files with 8 additions and 1 deletions

View File

@ -129,6 +129,10 @@ module Cask
metadata_main_container_path/"config.json"
end
def checksumable?
url.using.blank? || url.using == :post
end
def download_sha_path
metadata_main_container_path/"LATEST_DOWNLOAD_SHA256"
end
@ -136,12 +140,15 @@ module Cask
def new_download_sha
require "cask/installer"
# Call checksumable? before hashing
@new_download_sha ||= Installer.new(self, verify_download_integrity: false)
.download(quiet: true)
.instance_eval { |x| Digest::SHA256.file(x).hexdigest }
end
def outdated_download_sha?
return true unless checksumable?
current_download_sha = download_sha_path.read if download_sha_path.exist?
current_download_sha.blank? || current_download_sha != new_download_sha
end

View File

@ -397,7 +397,7 @@ module Cask
end
def save_download_sha
@cask.download_sha_path.atomic_write(@cask.new_download_sha)
@cask.download_sha_path.atomic_write(@cask.new_download_sha) if @cask.checksumable?
end
def uninstall