Skip to content

Commit 305167e

Browse files
download_strategy: fix caching of :latest downloads
1 parent 3c30845 commit 305167e

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

Library/Homebrew/download_strategy.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,6 @@ def fetch(timeout: nil)
469469
ohai "Downloading #{url}"
470470

471471
cached_location_valid = cached_location.exist?
472-
v = version
473-
cached_location_valid = false if v.is_a?(Cask::DSL::Version) && v.latest?
474472

475473
resolved_url, _, last_modified, file_size, is_redirection = begin
476474
resolve_url_basename_time_file_size(url, timeout: Utils::Timer.remaining!(end_time))
@@ -484,7 +482,7 @@ def fetch(timeout: nil)
484482
# The cached location is no longer fresh if either:
485483
# - Last-Modified value is newer than the file's timestamp
486484
# - Content-Length value is different than the file's size
487-
if cached_location_valid && !is_redirection
485+
if cached_location_valid
488486
newer_last_modified = last_modified && last_modified > cached_location.mtime
489487
different_file_size = file_size&.nonzero? && file_size != cached_location.size
490488
cached_location_valid = !(newer_last_modified || different_file_size)

0 commit comments

Comments
 (0)