Skip to content

Commit 35897fe

Browse files
authored
Merge pull request #19723 from boblail/lail/dont-invalidate-cached-location-if-redirect
fix: Don't invalidate the cached location if the response is a redirect
2 parents c370200 + a6a8306 commit 35897fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Library/Homebrew/download_strategy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,10 @@ def fetch(timeout: nil)
486486
# The cached location is no longer fresh if either:
487487
# - Last-Modified value is newer than the file's timestamp
488488
# - Content-Length value is different than the file's size
489-
cached_location_valid = if cached_location_valid
489+
if cached_location_valid && !is_redirection
490490
newer_last_modified = last_modified && last_modified > cached_location.mtime
491491
different_file_size = file_size&.nonzero? && file_size != cached_location.size
492-
!(newer_last_modified || different_file_size)
492+
cached_location_valid = !(newer_last_modified || different_file_size)
493493
end
494494

495495
if cached_location_valid

0 commit comments

Comments
 (0)