lib/geocoder/lookups/ip2location.rb in geocoder-1.5.0 vs lib/geocoder/lookups/ip2location.rb in geocoder-1.5.1
- old
+ new
@@ -25,10 +25,11 @@
ip: query.sanitized_text
}.merge(super)
end
def results(query)
- return [reserved_result(query.text)] if query.loopback_ip_address?
+ # don't look up a loopback or private address, just return the stored result
+ return [reserved_result(query.text)] if query.internal_ip_address?
return [] unless doc = fetch_data(query)
if doc["response"] == "INVALID ACCOUNT"
raise_error(Geocoder::InvalidApiKey) || Geocoder.log(:warn, "INVALID ACCOUNT")
return []
else