Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Redirect if search by lat/long and there is no address param

  • Loading branch information...
commit df45da34fa5f6baaac8a97a086d3b4c5cd5d4e8c 1 parent 9fdbfd8
@autarch autarch authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 lib/VegGuide/Role/Controller/Search.pm
View
13 lib/VegGuide/Role/Controller/Search.pm
@@ -121,7 +121,7 @@ sub _search_from_request {
%{ $extra || {} },
);
- $self->_redirect_on_bad_request( $c, %p );
+ $self->_redirect_on_bad_request( $c, $class, %p );
delete $p{$_} for grep {/^possible/} keys %p;
delete @p{qw( order_by sort_order page limit )};
@@ -131,9 +131,10 @@ sub _search_from_request {
}
sub _redirect_on_bad_request {
- my $self = shift;
- my $c = shift;
- my %p = @_;
+ my $self = shift;
+ my $c = shift;
+ my $class = shift;
+ my %p = @_;
# Some l33t hacker bot keeps trying to stick links in these
# parameters
@@ -147,6 +148,10 @@ sub _redirect_on_bad_request {
$c->redirect_and_detach( q{/}, 301 );
}
+ if ( $class =~ /ByLatLong/ && ! exists $p{address} ) {
+ $c->redirect_and_detach( q{/}, 301 );
+ }
+
my @bad_keys = qw( location_id new_query amp from );
# Some bad redirects pointed bots to these URIs and now they keep
Please sign in to comment.
Something went wrong with that request. Please try again.