Skip to content

Commit

Permalink
add Args(0) to controller actions not expected to recieve args
Browse files Browse the repository at this point in the history
Controller actions without an explicit Arg/Args are treated as having
infinite arguments. Add an Args(0) to the routes that are not expected
to have sub-paths.
  • Loading branch information
haarg committed Sep 28, 2024
1 parent 8bbdd3e commit 18dcf6b
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller.pm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ sub model {
return $model;
}

sub mapping : Path('_mapping') {
sub mapping : Path('_mapping') Args(0) {
my ( $self, $c ) = @_;
$c->stash(
$c->model('CPAN')->es->indices->get_mapping(
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/Login.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ sub auto : Private {
return 1;
}

sub index : Path {
sub index : Path Args(0) {
my ( $self, $c ) = @_;
my @login = map { "<li><a href=\"/login/" . lc($_) . "\">$_</a></li>" }
sort map /^Login::(.*)/, $c->controllers;
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/Login/GitHub.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ has [qw(consumer_key consumer_secret)] => (
required => 1,
);

sub index : Path {
sub index : Path Args(0) {
my ( $self, $c ) = @_;
if ( my $code = $c->req->params->{code} ) {
my $ua = LWP::UserAgent->new;
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/Login/Google.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ has [qw( consumer_key consumer_secret )] => (
required => 1,
);

sub index : Path {
sub index : Path Args(0) {
my ( $self, $c ) = @_;
my $req = $c->req;

Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/Login/PAUSE.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sub _build_cache {
);
}

sub index : Path {
sub index : Path Args(0) {
my ( $self, $c ) = @_;
my $code = $c->req->params->{code};
my $id;
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/Login/Twitter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sub nt {
);
}

sub index : Path {
sub index : Path Args(0) {
my ( $self, $c ) = @_;
my $req = $c->req;

Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/Pod.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ sub find_dist_links {
return $links;
}

sub render : Path('/pod_render') {
sub render : Path('/pod_render') Args(0) {
my ( $self, $c ) = @_;
my $pod = $c->req->parameters->{pod};
my $show_errors = !!$c->req->parameters->{show_errors};
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ sub bad_request : Private {
$c->forward( $c->view('JSON') );
}

sub robots : Path("robots.txt") {
sub robots : Path("robots.txt") Args(0) {
my ( $self, $c ) = @_;
$c->res->content_type("text/plain");
$c->res->body("User-agent: *\nDisallow: /\n");
Expand Down
2 changes: 1 addition & 1 deletion lib/MetaCPAN/Server/Controller/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ sub auto : Private {
return $c->user_exists;
}

sub index : Path {
sub index : Path Args(0) {
my ( $self, $c ) = @_;
$c->stash( $c->user->data );
delete $c->stash->{code};
Expand Down

0 comments on commit 18dcf6b

Please sign in to comment.