File tree 3 files changed +9
-3
lines changed
lib/MetaCPAN/Web/Controller
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' }
7
7
8
8
sub root : Chained(' /' ) PathPart(' dist' ) CaptureArgs(1) {
9
9
my ( $self , $c , $dist ) = @_ ;
10
+ if ( $dist =~ / [^A-Za-z0-9_\-\.\@\+ ]/ ) {
11
+ $c -> detach(' /not_found' );
12
+ }
10
13
$c -> stash( { distribution_name => $dist } );
11
14
}
12
15
Original file line number Diff line number Diff line change 37
37
</li>
38
38
%% }
39
39
<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>
42
42
<li><div><a href="#">Top</a></div></li>
43
43
%% }
44
44
%% override content -> {
51
51
%% }
52
52
<tr>
53
53
<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>
55
55
</tr>
56
56
</table>
57
57
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ test_psgi app, sub {
11
11
ok( my $res = $cb -> ( GET ' /dist/DOESNTEXIST' ), ' GET /dist/DOESNTEXIST' );
12
12
is( $res -> code, 404, ' code 404' );
13
13
14
+ ok( $res = $cb -> ( GET ' /dist/$$$$' ), ' GET /dist/$$$$' );
15
+ is( $res -> code, 404, ' code 404' );
16
+
14
17
ok( $res = $cb -> ( GET ' /release/AUTHORDOESNTEXIST/DOESNTEXIST' ),
15
18
' GET /release/AUTHORDOESNTEXIST/DOESNTEXIST' );
16
19
is( $res -> code, 404, ' code 404' );
You can’t perform that action at this time.
0 commit comments