]> git.openstreetmap.org Git - rails.git/blobdiff - lib/osm.rb
Merge remote-tracking branch 'upstream/pull/2495'
[rails.git] / lib / osm.rb
index 26ebca09f9a7a235a820b533be5c8742b6d89e09..3e4b5dcee4b005d8b4db2bc2b7e81bf8bf9eeedc 100644 (file)
@@ -513,15 +513,8 @@ module OSM
   def self.ip_to_country(ip_address)
     ipinfo = maxmind_database.lookup(ip_address) if Settings.key?(:maxmind_database)
 
-    if ipinfo&.found?
-      country = ipinfo.country.iso_code
-    else
-      country = http_client.get("https://api.hostip.info/country.php?ip=#{ip_address}").body
-      country = "GB" if country == "UK"
-    end
+    return ipinfo.country.iso_code if ipinfo&.found?
 
-    country
-  rescue StandardError
     nil
   end