X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FCGI.pm;h=7dabb1ef47cd394d46c3ad51f3a494067d5b9277;hb=466f7faff129a5699c7674f59900a92aa256175d;hp=a80397f4ed18524069cbd3c3137e79f964a9d41e;hpb=aa31d051e7408930a2628513534deae237201a75;p=debbugs.git diff --git a/Debbugs/CGI.pm b/Debbugs/CGI.pm index a80397f..7dabb1e 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; @@ -146,6 +147,8 @@ Creates a link to the version cgi script =item fixed -- arrayref of fixed versions +=item format -- optional image format override + =item width -- optional width of graph =item height -- optional height of graph @@ -170,6 +173,9 @@ sub version_url{ fixed => {type => ARRAYREF, default => [], }, + format => {type => SCALAR, + optional => 1, + }, width => {type => SCALAR, optional => 1, }, @@ -409,8 +415,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?', @@ -470,23 +474,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}}; @@ -503,8 +508,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;