diff --git a/src/Provider/GeoIP2/GeoIP2.php b/src/Provider/GeoIP2/GeoIP2.php index 3171f8f29..f188dc2a3 100644 --- a/src/Provider/GeoIP2/GeoIP2.php +++ b/src/Provider/GeoIP2/GeoIP2.php @@ -47,9 +47,10 @@ public function __construct(GeoIP2Adapter $adapter) public function geocodeQuery(GeocodeQuery $query): Collection { $address = $query->getText(); + $address = explode(',', $address)[0]; $locale = $query->getLocale() ?: 'en'; // Default to English if (!filter_var($address, FILTER_VALIDATE_IP)) { - throw new UnsupportedOperation('The GeoIP2 provider does not support street addresses, only IP addresses.'); + throw new UnsupportedOperation(sprintf('"%s" must be called with an IP addresses. Got "%s" instead.', __METHOD__, $address)); } if ('127.0.0.1' === $address) { @@ -110,6 +111,7 @@ public function getName(): string */ private function executeQuery(string $address): string { + $address = explode(',', $address)[0]; $uri = sprintf('file://geoip?%s', $address); try {