Skip to content

Commit fdc134b

Browse files
committed
fix the pod end point when given a module name
The find_pod method would sometimes return the source and sometimes a full record from Elasticsearch. Fix the return to always return the source, and adjust the caller to work with this form.
1 parent 8033be9 commit fdc134b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
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 {

0 commit comments

Comments
 (0)