diff --git a/lib/MetaCPAN/Web/Model/ReleaseInfo.pm b/lib/MetaCPAN/Web/Model/ReleaseInfo.pm index d2fa4d4753..ee44016622 100644 --- a/lib/MetaCPAN/Web/Model/ReleaseInfo.pm +++ b/lib/MetaCPAN/Web/Model/ReleaseInfo.pm @@ -11,6 +11,8 @@ use MetaCPAN::Web::Types qw( HashRef Object ); use URI; use URI::Escape qw(uri_escape uri_unescape); use URI::QueryParam; # Add methods to URI. +use Importer 'MetaCPAN::Web::Elasticsearch::Adapter' => + qw/ single_valued_arrayref_to_scalar /; sub ACCEPT_CONTEXT { my ( $class, $c, $args ) = @_; @@ -63,7 +65,9 @@ sub summary_hash { # massage the x_contributors field into what we want sub groom_contributors { my ($self) = @_; - my ( $release, $author ) = ( $self->release, $self->author ); + my ( $release, $author ) + = ( $self->release, + single_valued_arrayref_to_scalar( $self->author ) ); my $contribs = $release->{metadata}{x_contributors} || []; my $authors = $release->{metadata}{author} || []; @@ -82,11 +86,8 @@ sub groom_contributors { $authors = [ grep { $_ ne 'unknown' } @$authors ]; my $author_info = { - email => [ - lc "$release->{author}\@cpan.org", - @{ $author->{email} || [] }, - ], - name => $author->{name}, + email => [ lc "$release->{author}\@cpan.org", $author->{email} ], + name => $author->{name}, }; my %seen = map { $_ => $author_info } ( @{ $author_info->{email} }, $author_info->{name}, ); diff --git a/t/controller/shared/release-info.t b/t/controller/shared/release-info.t index efaa0f1cf9..aa92897806 100644 --- a/t/controller/shared/release-info.t +++ b/t/controller/shared/release-info.t @@ -58,7 +58,8 @@ test_psgi app, sub { module => 'LWP::UserAgent', release => 'libwww-perl', repository => 0, - home_page => 0 + home_page => 0, + issues => 'https://github.com/libwww-perl/libwww-perl/issues', }, # no optional tests