Skip to content

Commit f51769c

Browse files
committed
skip the iteration when changelog cannot be read properly.
1 parent 054c20f commit f51769c

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

lib/MetaCPAN/Server/Controller/Changes.pm

+5-10
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,15 @@ sub by_releases : Path('by_releases') : Args(0) {
7676
for my $release ( @{ $ret->{releases} } ) {
7777
my ( $author, $name, $path )
7878
= @{$release}{qw(author name changes_file)};
79-
my $source = $c->model('Source')->path( $author, $name, $path ) // '';
79+
my $source = $c->model('Source')->path( $author, $name, $path ) or next;
8080

81-
my $content;
82-
try {
83-
local $/;
84-
$content = Encode::decode(
81+
my $content = try {
82+
Encode::decode(
8583
'UTF-8',
86-
( scalar $source->openr->getline ),
84+
( scalar $source->slurp ),
8785
Encode::FB_CROAK | Encode::LEAVE_SRC
8886
);
89-
}
90-
catch {
91-
$content = undef;
92-
};
87+
} or next;
9388

9489
push @changes,
9590
{

0 commit comments

Comments
 (0)