mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Simplify logic in RedirectRule when checking geolocation conditions
This commit is contained in:
@@ -293,5 +293,10 @@ function ipAddressFromRequest(ServerRequestInterface $request): string|null
|
||||
|
||||
function geolocationFromRequest(ServerRequestInterface $request): Location|null
|
||||
{
|
||||
return $request->getAttribute(Location::class);
|
||||
$geolocation = $request->getAttribute(Location::class);
|
||||
if ($geolocation !== null && ! $geolocation instanceof Location) {
|
||||
// TODO Throw exception
|
||||
}
|
||||
|
||||
return $geolocation;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user