lib/license_scout/license.rb in license_scout-2.0.13 vs lib/license_scout/license.rb in license_scout-2.0.14
- old
+ new
@@ -105,22 +105,22 @@
new_url = raw_github_url(contents_url)
begin
LicenseScout::Log.debug("[license] Pulling license content for #{license_id} from #{new_url}")
open(new_url).read
- rescue OpenURI::HTTPError, Errno::ECONNREFUSED, SocketError
- LicenseScout::Log.warn("[license] Unable to download license for #{license_id} from #{new_url}")
- nil
rescue RuntimeError => e
if e.message =~ /redirection forbidden/
m = /redirection forbidden:\s+(.+)\s+->\s+(.+)/.match(e.message)
new_https_url = m[2].gsub("http://", "https://")
LicenseScout::Log.debug("[license] Retrying download of #{license_id} from #{new_https_url}")
license_content(license_id, new_https_url)
else
raise e
end
+ rescue
+ LicenseScout::Log.warn("[license] Unable to download license for #{license_id} from #{new_url}")
+ nil
end
end
end
def raw_github_url(url)