Skip to content

Commit

Permalink
if url from opensearch is used directly, forward to home
Browse files Browse the repository at this point in the history
The query will otherwise be passed to elasticsearch and be an error.
  • Loading branch information
haarg committed May 24, 2018
1 parent ebd7cf8 commit dbb88b1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/MetaCPAN/Web/Controller/Search.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ sub index : Path : Args(0) {

my $query = join( q{ }, $req->param('q') );

if ( $query eq '{searchTerms}' ) {

# url is being used directly from opensearch plugin
$c->res->redirect(q{/});
$c->detach;
}

# translate Foo/Bar.pm to Foo::Bar
if ( $query =~ m{.pm\b} ) {
$query =~ s{/}{::}g;
Expand Down

0 comments on commit dbb88b1

Please sign in to comment.