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
This commit is contained in:
Mike McQuaid 2025-04-09 13:19:14 +00:00 committed by GitHub
commit 35897fe49c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -486,10 +486,10 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
# The cached location is no longer fresh if either:
# - Last-Modified value is newer than the file's timestamp
# - Content-Length value is different than the file's size
cached_location_valid = if cached_location_valid
if cached_location_valid && !is_redirection
newer_last_modified = last_modified && last_modified > cached_location.mtime
different_file_size = file_size&.nonzero? && file_size != cached_location.size
!(newer_last_modified || different_file_size)
cached_location_valid = !(newer_last_modified || different_file_size)
end
if cached_location_valid