Unverified Commit 247539fc authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Properly check for valid lon/lat

Closes #383
parent 4b5344d3
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -144,7 +144,13 @@ sub geolocation {
	my $lat        = $self->param('lat');
	my $backend_id = $self->param('backend') // 0;

	if ( not $lon or not $lat ) {
	if (
		not(    defined $lon
			and defined $lat
			and $lon =~ m{^ \d+ [.]? \d* $}x
			and $lat =~ m{^ \d+ [.]? \d* $}x )
	  )
	{
		$self->render(
			json => { error => "Invalid lon/lat (${lon}/${lat}) received" } );
		return;