diff options
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index 6b421d1..cbe3e4a 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -511,8 +511,15 @@ sub geolocation { my $lat = $self->param('lat'); my $backend_id = $self->param('backend') // 0; - if ( not $lon or not $lat or $backend_id !~ m{ ^ \d+ $ }x ) { - $self->render( json => { error => 'Invalid lon/lat received' } ); + if ( not $lon or not $lat ) { + $self->render( + json => { error => "Invalid lon/lat (${lon}/${lat}) received" } ); + return; + } + + if ( $backend_id !~ m{ ^ \d+ $ }x ) { + $self->render( + json => { error => "Invalid backend (${backend_id}) received" } ); return; } |