File tree 2 files changed +9
-7
lines changed
lib/MetaCPAN/Web/Controller
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,12 @@ sub default : Path {
54
54
55
55
sub not_found : Private {
56
56
my ( $self , $c ) = @_ ;
57
- $c -> stash( { template => ' not_found.html' } );
57
+ $c -> stash(
58
+ {
59
+ template => ' not_found.html' ,
60
+ search => [ @{ $c -> req-> args }, @{ $c -> req-> captures } ],
61
+ }
62
+ );
58
63
$c -> response-> status(404);
59
64
}
60
65
Original file line number Diff line number Diff line change @@ -19,14 +19,11 @@ <h1>Not Found</h1>
19
19
< % END %>
20
20
21
21
< %
22
- # FIXME: this drops the first two url components and suggests a search
23
- # for the rest (which makes fragile assumptions).
24
- q = req.path.split('/');
25
- IF q.size > 2;
26
- q = q.splice(2, 99).join(" ");
22
+ IF search and search.size;
23
+ q = search.join(" ");
27
24
%>
28
25
< p >
29
- Search the CPAN for < a href ="/search?q=<% q %> "> < % q %> </ a >
26
+ Search the CPAN for < a href ="/search?q=<% q | url %> "> < % q %> </ a >
30
27
</ p >
31
28
< % END %>
32
29
</ p >
You can’t perform that action at this time.
0 commit comments