X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FControl.pm;h=44d0062e9a9bc4ae1ccc21cb2d46d97451f4211b;hb=428eb4599f1aad8c4c5b71d02b91252a1daba24d;hp=5739734b06f24f623ff6ddfc37391451c226fcdf;hpb=a35b0737599506735c5f7f009269e117a58be925;p=debbugs.git
diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm
index 5739734..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();
@@ -2662,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.
@@ -2750,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;
}
@@ -2784,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|
@@ -3437,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";
@@ -3466,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})),
};
}
@@ -3590,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!";