X-Git-Url: https://git.donarmstrong.com/?p=debbugs.git;a=blobdiff_plain;f=Debbugs%2FCGI.pm;h=dffa8ec1e021a896f1d42c782f76807dadda395c;hp=b5c24ddbc648e7db0d133d1b1ecd83c4b7543eeb;hb=b1252b6797aa6a79d00a32165fb2fa8fb1bd9318;hpb=2a2dd12fbe59631a5d4cdd6c1607b6181ead5782 diff --git a/Debbugs/CGI.pm b/Debbugs/CGI.pm index b5c24dd..dffa8ec 100644 --- a/Debbugs/CGI.pm +++ b/Debbugs/CGI.pm @@ -78,6 +78,7 @@ use Debbugs::User qw(); use Mail::Address; use POSIX qw(ceil); use Storable qw(dclone); +use Scalar::Util qw(looks_like_number); use List::AllUtils qw(max); use File::stat; @@ -394,10 +395,11 @@ sub package_links { } if ($has_options) { push @links, - munge_url('pkgreport.cgi?', + (munge_url('pkgreport.cgi?', %options, $t_type => $target, - ); + ), + $target); } else { push @links, ('pkgreport.cgi?'.$t_type.'='.uri_escape_utf8($target), @@ -408,8 +410,6 @@ sub package_links { for my $type (qw(maint owner submitter correspondent)) { next unless exists $param{$type}; for my $target (make_list($param{$type})) { - my $addr = getparsedaddrs($target); - $addr = defined $addr?$addr->address:''; if ($has_options) { push @links, (munge_url('pkgreport.cgi?', @@ -469,23 +469,24 @@ returning htmlized links. =cut sub bug_links { + state $spec = {bug => {type => SCALAR|ARRAYREF, + optional => 1, + }, + links_only => {type => BOOLEAN, + default => 0, + }, + class => {type => SCALAR, + default => '', + }, + separator => {type => SCALAR, + default => ', ', + }, + options => {type => HASHREF, + default => {}, + }, + }; my %param = validate_with(params => \@_, - spec => {bug => {type => SCALAR|ARRAYREF, - optional => 1, - }, - links_only => {type => BOOLEAN, - default => 0, - }, - class => {type => SCALAR, - default => '', - }, - separator => {type => SCALAR, - default => ', ', - }, - options => {type => HASHREF, - default => {}, - }, - }, + spec => $spec, ); my %options = %{$param{options}}; @@ -502,7 +503,11 @@ sub bug_links { $_); } make_list($param{bug}) if exists $param{bug}; } else { - push @links, map {'bugreport.cgi?bug='.uri_escape_utf8($_)} + push @links, + map {my $b = ceil($_); + ('bugreport.cgi?bug='.$b, + $b)} + grep {looks_like_number($_)} make_list($param{bug}) if exists $param{bug}; } my @return;