A platform for community discussion. Free, open, simple.
FIX: warn instead of excepting if MaxMind DBs can't be downloaded (#7600)
Michael Brown5bfeef770534
diff --git a/lib/discourse_ip_info.rb b/lib/discourse_ip_info.rbindex 37b0fa2e74d..ad04661c482 100644--- a/lib/discourse_ip_info.rb+++ b/lib/discourse_ip_info.rb@@ -27,16 +27,20 @@ class DiscourseIpInfodef self.mmdb_download(name)FileUtils.mkdir_p(path)- gz_file = FileHelper.download(- "https://geolite.maxmind.com/geoip/databases/#{name}/update",- max_file_size: 100.megabytes,- tmp_file_name: "#{name}.gz"- )-- Discourse::Utils.execute_command("gunzip", gz_file.path)-- path = gz_file.path.sub(/\.gz\z/, "")- FileUtils.mv(path, mmdb_path(name))+ begin+ gz_file = FileHelper.download(+ "https://geolite.maxmind.com/geoip/databases/#{name}/update",+ max_file_size: 100.megabytes,+ tmp_file_name: "#{name}.gz"+ )++ Discourse::Utils.execute_command("gunzip", gz_file.path)++ path = gz_file.path.sub(/\.gz\z/, "")+ FileUtils.mv(path, mmdb_path(name))+ rescue HTTPError => e+ Rails.logger.warn("MaxMindDB (#{name}) could not be downloaded: #{e}")+ endensuregz_file&.close!end