download_strategy: fix caching of :latest
downloads
This commit is contained in:
parent
fb9d1c5a1c
commit
5ff58d2df0
@ -469,8 +469,6 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
ohai "Downloading #{url}"
|
ohai "Downloading #{url}"
|
||||||
|
|
||||||
cached_location_valid = cached_location.exist?
|
cached_location_valid = cached_location.exist?
|
||||||
v = version
|
|
||||||
cached_location_valid = false if v.is_a?(Cask::DSL::Version) && v.latest?
|
|
||||||
|
|
||||||
resolved_url, _, last_modified, file_size, is_redirection = begin
|
resolved_url, _, last_modified, file_size, is_redirection = begin
|
||||||
resolve_url_basename_time_file_size(url, timeout: Utils::Timer.remaining!(end_time))
|
resolve_url_basename_time_file_size(url, timeout: Utils::Timer.remaining!(end_time))
|
||||||
@ -484,7 +482,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
# The cached location is no longer fresh if either:
|
# The cached location is no longer fresh if either:
|
||||||
# - Last-Modified value is newer than the file's timestamp
|
# - Last-Modified value is newer than the file's timestamp
|
||||||
# - Content-Length value is different than the file's size
|
# - Content-Length value is different than the file's size
|
||||||
if cached_location_valid && !is_redirection
|
if cached_location_valid
|
||||||
newer_last_modified = last_modified && last_modified > cached_location.mtime
|
newer_last_modified = last_modified && last_modified > cached_location.mtime
|
||||||
different_file_size = file_size&.nonzero? && file_size != cached_location.size
|
different_file_size = file_size&.nonzero? && file_size != cached_location.size
|
||||||
cached_location_valid = !(newer_last_modified || different_file_size)
|
cached_location_valid = !(newer_last_modified || different_file_size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user