From 05d9622c0298004f6cbfc678728cce7c32f38451 Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Thu, 18 Jun 2015 21:46:47 +0800 Subject: [PATCH] download_strategy: don't check url if already downloaded Closes Homebrew/homebrew#40859. Signed-off-by: Xu Cheng --- Library/Homebrew/download_strategy.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 93cd4250c9..1b84a2422d 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -270,16 +270,16 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy def fetch ohai "Downloading #{@url}" - urls = actual_urls - unless urls.empty? - ohai "Downloading from: #{urls.last}" - if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && - urls.any? { |u| !u.start_with? "https://" } - raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." - end - end - unless cached_location.exist? + urls = actual_urls + unless urls.empty? + ohai "Downloading from: #{urls.last}" + if !ENV["HOMEBREW_NO_INSECURE_REDIRECT"].nil? && @url.start_with?("https://") && + urls.any? { |u| !u.start_with? "https://" } + raise "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." + end + end + had_incomplete_download = temporary_path.exist? begin _fetch