Skip to content

Commit c4b53c7

Browse files
committed
Merge pull request metacpan#245 from brianphillips/master
don't blow up on invalid author website URLs
2 parents 2a42f96 + 42519d6 commit c4b53c7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/MetaCPAN/Web/View/HTML.pm

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,12 @@ Template::Alloy->define_vmethod(
9898
Template::Alloy->define_vmethod(
9999
'text',
100100
decode_punycode => sub {
101-
URI->new(shift)->ihost;
101+
my $url_string = shift;
102+
my $uri = URI->new($url_string);
103+
if(!$uri->scheme){
104+
$uri = URI->new("http://$url_string"); # default to http:// if no scheme in original...
105+
}
106+
return $uri->ihost;
102107
}
103108
);
104109

0 commit comments

Comments
 (0)