Skip to content

Commit 44202f7

Browse files
authored
Merge pull request #1386 from metacpan/haarg/fix-pod-endpoint
fix the pod end point when given a module name
2 parents ac26b19 + fdc134b commit 44202f7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/MetaCPAN/Query/File.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ sub find_pod {
679679
query => $query,
680680
},
681681
);
682-
return $pod_file->{hits}{hits}[0];
682+
return $pod_file->{hits}{hits}[0]->{_source};
683683
}
684684
else {
685685
return $file;

lib/MetaCPAN/Server/Controller/Pod.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ sub get : Path('') : Args(1) {
3838
my ( $self, $c, $module ) = @_;
3939
$module = $c->model('ESQuery')->file->find_pod($module)
4040
or $c->detach( '/not_found', [] );
41-
$c->forward( 'find',
42-
[ map { $module->{_source}{$_} } qw(author release path) ] );
41+
$c->forward( 'find', [ map { $module->{$_} } qw(author release path) ] );
4342
}
4443

4544
sub find_dist_links {

lib/MetaCPAN/Server/Model/Source.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ sub path {
8787
my $source = $source_base->child( $distvname, @file );
8888
return $source
8989
if -e $source;
90+
91+
# if the directory exists, we already extracted the archive, so if the
92+
# file didn't exist, we can stop here
9093
return undef
91-
if -e $source_base->child($distvname); # previously extracted, but file does not exist
94+
if -e $source_base->child($distvname);
9295

9396
my $release_data
9497
= $self->es_query->release->by_author_and_name( $pauseid, $distvname )

0 commit comments

Comments
 (0)