From f43b0dcf82488db8fd4be1646e8e463b3ec7eecb Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Sun, 27 Jan 2008 12:26:40 -0800 Subject: [PATCH] * Fix linking to pkgs when there are names containing ' * Add missing html_escape() calls --- cgi/bugreport.cgi | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/cgi/bugreport.cgi b/cgi/bugreport.cgi index 856a35b..3138772 100755 --- a/cgi/bugreport.cgi +++ b/cgi/bugreport.cgi @@ -122,7 +122,7 @@ sub display_entity ($$$$\$\@) { push @dlargs, (filename=>$filename) if $filename ne ''; my $printname = $filename; $printname = 'Message part ' . ($#$attachments + 1) if $filename eq ''; - $$this .= '
[$printname } .
+	$$this .= '
[$printname } .
 		  "($type, $disposition)]
\n"; if ($msg and defined($att) and $att == $#$attachments) { @@ -186,7 +186,7 @@ sub display_entity ($$$$\$\@) { $body =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),$1$3,go; # Add links to bug closures $body =~ s[(closes:\s*(?:bug)?\#?\s?\d+(?:,?\s*(?:bug)?\#?\s?\d+)*) - ][my $temp = $1; $temp =~ s{(\d+)}{qq($1)}ge; $temp;]gxie; + ][my $temp = $1; $temp =~ s{(\d+)}{qq($1)}ge; $temp;]gxie; $$this .= qq(
$body
\n); } } @@ -237,17 +237,17 @@ if ($status{severity} eq 'normal') { if (@{$status{found_versions}} or @{$status{fixed_versions}}) { $indexentry.= q(
version graph
}; + html_escape(version_url($status{package}, + $status{found_versions}, + $status{fixed_versions}, + 2, + 2, + )).qq{">}; } @@ -263,7 +263,7 @@ foreach my $pkg (@tpacks) { : "Maintainers for $pkg are\n" }, $tmaint); $indexentry .= ";\nSource for $pkg is\n". - '$tsrc" if ($tsrc ne "(unknown)"); + '$tsrc" if ($tsrc ne "(unknown)"); $indexentry .= ".\n"; } @@ -291,7 +291,7 @@ if (@merged) { my $descmerged = 'Merged with '; my $mseparator = ''; for my $m (@merged) { - $descmerged .= $mseparator."#$m"; + $descmerged .= $mseparator."#$m"; $mseparator= ",\n"; } push @descstates, $descmerged; @@ -315,10 +315,10 @@ if (@{$status{fixed_versions}}) { if (@{$status{found_versions}} or @{$status{fixed_versions}}) { push @descstates, 'Version Graph}; + html_escape(version_url($status{package}, + $status{found_versions}, + $status{fixed_versions}, + )).qq{">Version Graph}; } if (length($status{done})) { @@ -326,8 +326,8 @@ if (length($status{done})) { } if (length($status{forwarded})) { - my $forward_link = $status{forwarded}; - $forward_link =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),$1$3,go; + my $forward_link = html_escape($status{forwarded}); + $forward_link =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),$1$3,go; push @descstates, "Forwarded to $forward_link"; } @@ -337,7 +337,7 @@ if (@blockedby && $status{"pending"} ne 'fixed' && ! length($status{done})) { for my $b (@blockedby) { my %s = %{get_bug_status($b)}; next if $s{"pending"} eq 'fixed' || length $s{done}; - push @descstates, "Fix blocked by #$b: ".html_escape($s{subject}); + push @descstates, "Fix blocked by #$b: ".html_escape($s{subject}); } } @@ -346,7 +346,7 @@ if (@blocks && $status{"pending"} ne 'fixed' && ! length($status{done})) { for my $b (@blocks) { my %s = %{get_bug_status($b)}; next if $s{"pending"} eq 'fixed' || length $s{done}; - push @descstates, "Blocking fix for #$b: ".html_escape($s{subject}); + push @descstates, "Blocking fix for #$b: ".html_escape($s{subject}); } } @@ -439,13 +439,13 @@ sub handle_record{ {(defined $2?$1.bug_links($2):'').$3. join(' ',map {bug_links($_)} (split /\,?\s+/, $4))}eo; # Add links to reassigned packages - $output =~ s{(Bug reassigned from package \`)([^']+)((?:'|\&\#39;) to \`)([^']+)((?:'|\&\#39;))} - {$1.q($2).$3.q($4).$5}eo; + $output =~ s{(Bug reassigned from package \`)([^']+?)((?:'|\&\#39;) to \`)([^']+?)((?:'|\&\#39;))} + {$1.q($2).$3.q($4).$5}eo; if (defined $time) { $output .= ' ('.strftime('%a, %d %b %Y %T GMT',gmtime($time)).') '; } - $output .= 'Full text and rfc822 format available.'; + $output .= 'Full text and rfc822 format available.'; $output = qq(

\n\n) . $output . "
\n"; } @@ -458,7 +458,7 @@ sub handle_record{ $$seen_msg_ids{$msg_id} = 1; } $output .= qq(

\n); - $output .= 'View this message in rfc822 format

'; + $output .= 'View this message in rfc822 format

'; $output .= handle_email_message($record->{text}, ref => $bug_number, msg_number => $msg_number, @@ -479,8 +479,8 @@ sub handle_record{ my ($received,$hostname) = $record->{text} =~ m/Received: \(at (\S+)\) by (\S+)\;/; $output .= qq|

Message received at |. html_escape("$received\@$hostname") . - q| (full text'. - q|, mbox)'.":

\n"; + q| (full text'. + q|, mbox)'.":

\n"; $output .= handle_email_message($record->{text}, ref => $bug_number, msg_number => $msg_number, -- 2.39.2