Skip to content

Commit 3208468

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 3208468

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ sub get : Path('') : Args(1) {
3939
$module = $c->model('ESQuery')->file->find_pod($module)
4040
or $c->detach( '/not_found', [] );
4141
$c->forward( 'find',
42-
[ map { $module->{_source}{$_} } qw(author release path) ] );
42+
[ map { $module->{$_} } qw(author release path) ] );
4343
}
4444

4545
sub find_dist_links {

0 commit comments

Comments
 (0)