X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FControl.pm;h=44d0062e9a9bc4ae1ccc21cb2d46d97451f4211b;hb=c04432ba467f7f957835b7264157951787e27f4c;hp=33db8816a2a28f5ac5de974b71cdac7f3eb5ed90;hpb=c89a96b3d745f9ae157da11f8c86f45883fbeb5d;p=debbugs.git diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm index 33db881..44d0062 100644 --- a/Debbugs/Control.pm +++ b/Debbugs/Control.pm @@ -110,7 +110,8 @@ BEGIN{ } use Debbugs::Config qw(:config); -use Debbugs::Common qw(:lock buglog :misc get_hashname sort_versions :utf8); +use Debbugs::Common qw(:lock buglog :misc get_hashname sort_versions); +use Debbugs::UTF8; use Debbugs::Status qw(bug_archiveable :read :hook writebug new_bug splitpackages split_status_fields get_bug_status); use Debbugs::CGI qw(html_escape); use Debbugs::Log qw(:misc :write); @@ -125,7 +126,7 @@ use IO::File; use Debbugs::Text qw(:templates); -use Debbugs::Mail qw(rfc822_date send_mail_message default_headers); +use Debbugs::Mail qw(rfc822_date send_mail_message default_headers encode_headers); use Debbugs::MIME qw(create_mime_message); use Mail::RFC822::Address qw(); @@ -1578,7 +1579,11 @@ sub set_found { if (not @svers) { @svers = $version; } - else { + elsif (not grep {$version eq $_} @svers) { + # The $version was not equal to one of the source + # versions, so it's probably unqualified (or just + # wrong). Delete it, and use the source versions + # instead. if (exists $found_versions{$version}) { delete $found_versions{$version}; $found_removed{$version} = 1; @@ -2658,7 +2663,7 @@ Handles all setting of summary fields If summary is undef, unsets the summary -If summary is 0, sets the summary to the first paragraph contained in +If summary is 0 or -1, sets the summary to the first paragraph contained in the message passed. If summary is a positive integer, sets the summary to the message specified. @@ -2746,7 +2751,7 @@ sub _summary { elsif ($param{$cmd} =~ /^\d+$/) { my $log = []; my @records = Debbugs::Log::read_log_records(bug_num => $param{bug}); - if ($param{$cmd} == 0) { + if ($param{$cmd} == 0 or $param{$cmd} == -1) { $log = $param{message}; $summary_msg = @records + 1; } @@ -2780,7 +2785,7 @@ sub _summary { } # skip a paragraph if it looks like it's control or # pseudo-headers - if ($line =~ m{^\s*(?:Package|Source|Version|User|Tag|Severity)\:\s+\S}xi or #pseudo headers + if ($line =~ m{^\s*(?:Package|Source|Version|User|Tag|Severity|Control)\:\s+\S}xi or #pseudo headers $line =~ m{^(?:package:?|(?:no|)owner|severity|tags?|summary| #control \#|reopen|close|(?:not|)(?:fixed|found)|clone| debug|(?:not|)forwarded|priority| @@ -3433,25 +3438,25 @@ sub append_action_to_log{ } my $msg = join('', (exists $param{command} ? - "\n":"" + "\n":"" ), (length $param{requester} ? - "\n":"" + "\n":"" ), (length $param{request_addr} ? - "\n":"" + "\n":"" ), "\n", $data_diff, - "".html_escape(encode_utf8($param{action}))."\n"); + "".html_escape(encode_utf8_safely($param{action}))."\n"); if (length $param{requester}) { - $msg .= "Request was from ".html_escape(encode_utf8($param{requester}))."\n"; + $msg .= "Request was from ".html_escape(encode_utf8_safely($param{requester}))."\n"; } if (length $param{request_addr}) { - $msg .= "to ".html_escape(encode_utf8($param{request_addr})).""; + $msg .= "to ".html_escape(encode_utf8_safely($param{request_addr})).""; } if (length $param{desc}) { - $msg .= ":
\n".encode_utf8($param{desc})."\n"; + $msg .= ":
\n".encode_utf8_safely($param{desc})."\n"; } else { $msg .= ".\n"; @@ -3462,7 +3467,7 @@ sub append_action_to_log{ $msg = ''; if ((ref($param{message}) and @{$param{message}}) or length($param{message})) { push @records, {type => exists $param{recips}?'recips':'incoming-recv', - exists $param{recips}?(recips => [make_list($param{recips})]):(), + exists $param{recips}?(recips => [map {encode_utf8_safely($_)} make_list($param{recips})]):(), text => join('',make_list($param{message})), }; } @@ -3586,13 +3591,14 @@ sub __return_append_to_log_options{ } if (not exists $param{message}) { my $date = rfc822_date(); - $param{message} = fill_in_template(template => 'mail/fake_control_message', - variables => {request_addr => $param{request_addr}, - requester => $param{requester}, - date => $date, - action => $action - }, - ); + $param{message} = + encode_headers(fill_in_template(template => 'mail/fake_control_message', + variables => {request_addr => $param{request_addr}, + requester => $param{requester}, + date => $date, + action => $action + }, + )); } if (not defined $action) { carp "Undefined action!";