File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
lib/MetaCPAN/Web/Controller Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ BEGIN { extends 'MetaCPAN::Web::Controller' }
77
88sub root : Chained(' /' ) PathPart(' dist' ) CaptureArgs(1) {
99 my ( $self , $c , $dist ) = @_ ;
10+ if ( $dist =~ / [^A-Za-z0-9_\-\.\@\+ ]/ ) {
11+ $c -> detach(' /not_found' );
12+ }
1013 $c -> stash( { distribution_name => $dist } );
1114}
1215
Original file line number Diff line number Diff line change 3737 </li>
3838 %% }
3939 <li class="nav-header">Info</li>
40- <li>[% pluralize("%d insertion(s)", $diff.statistics.map(-> $f { $f.insertions }).sum()) %]</li>
41- <li>[% pluralize("%d deletion(s)", $diff.statistics.map(-> $f { $f.deletions }).sum()) %]</li>
40+ <li>[% pluralize("%d insertion(s)", $diff.statistics.map(-> $f { $f.insertions }).grep(rx('^\d+$')). sum()) %]</li>
41+ <li>[% pluralize("%d deletion(s)", $diff.statistics.map(-> $f { $f.deletions }).grep(rx('^\d+$')). sum()) %]</li>
4242 <li><div><a href="#">Top</a></div></li>
4343%% }
4444%% override content -> {
5151 %% }
5252 <tr>
5353 <td>[% pluralize("%s file(s)", $diff.statistics.size()) %] changed (This is a [% $diff.source.file ? 'file' : 'version' %] diff)</td>
54- <td><span class="minus">[% $diff.statistics.map(-> $f { $f.deletions }).sum() %]</span><span class="plus">[% $diff.statistics.map(-> $f { $f.insertions }).sum() %]</span></td>
54+ <td><span class="minus">[% $diff.statistics.map(-> $f { $f.deletions }).grep(rx('^\d+$')). sum() %]</span><span class="plus">[% $diff.statistics.map(-> $f { $f.insertions }).grep(rx('^\d+$') ).sum() %]</span></td>
5555 </tr>
5656 </table>
5757
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ test_psgi app, sub {
1111 ok( my $res = $cb -> ( GET ' /dist/DOESNTEXIST' ), ' GET /dist/DOESNTEXIST' );
1212 is( $res -> code, 404, ' code 404' );
1313
14+ ok( $res = $cb -> ( GET ' /dist/$$$$' ), ' GET /dist/$$$$' );
15+ is( $res -> code, 404, ' code 404' );
16+
1417 ok( $res = $cb -> ( GET ' /release/AUTHORDOESNTEXIST/DOESNTEXIST' ),
1518 ' GET /release/AUTHORDOESNTEXIST/DOESNTEXIST' );
1619 is( $res -> code, 404, ' code 404' );
You can’t perform that action at this time.
0 commit comments