Unverified Commit 2a918621 authored by Dave Miller's avatar Dave Miller Committed by GitHub

Bug 1880288: Noncharacters in comments cause bugmail sending to fail

parent 34673924
...@@ -13,7 +13,7 @@ use 5.14.0; ...@@ -13,7 +13,7 @@ use 5.14.0;
use parent qw(Email::MIME); use parent qw(Email::MIME);
sub new { sub new {
my ($class, $msg) = @_; my ($class, $msg, $args) = @_;
# Template-Toolkit trims trailing newlines, which is problematic when # Template-Toolkit trims trailing newlines, which is problematic when
# parsing headers. # parsing headers.
...@@ -52,7 +52,7 @@ sub new { ...@@ -52,7 +52,7 @@ sub new {
# you're running on. See http://perldoc.perl.org/perlport.html#Newlines # you're running on. See http://perldoc.perl.org/perlport.html#Newlines
$msg =~ s/(?:\015+)?\012/\015\012/msg; $msg =~ s/(?:\015+)?\012/\015\012/msg;
return $class->SUPER::new($msg); return $class->SUPER::new($msg, $args);
} }
sub as_string { sub as_string {
...@@ -113,7 +113,7 @@ workarounds. ...@@ -113,7 +113,7 @@ workarounds.
=head1 SYNOPSIS =head1 SYNOPSIS
use Bugzilla::MIME; use Bugzilla::MIME;
my $email = Bugzilla::MIME->new($message); my $email = Bugzilla::MIME->new($message, $args);
=head1 DESCRIPTION =head1 DESCRIPTION
......
...@@ -21,6 +21,7 @@ use Bugzilla::MIME; ...@@ -21,6 +21,7 @@ use Bugzilla::MIME;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Util; use Bugzilla::Util;
use Encode qw()
use Date::Format qw(time2str); use Date::Format qw(time2str);
use Email::Sender::Simple qw(sendmail); use Email::Sender::Simple qw(sendmail);
...@@ -61,6 +62,7 @@ sub generate_email { ...@@ -61,6 +62,7 @@ sub generate_email {
encoding => 'quoted-printable', encoding => 'quoted-printable',
}, },
body_str => $msg_text, body_str => $msg_text,
encode_check => Encode::FB_DEFAULT
)); ));
if ($templates->{html} && $email_format eq 'html') { if ($templates->{html} && $email_format eq 'html') {
$template->process($templates->{html}, $vars, \$msg_html) $template->process($templates->{html}, $vars, \$msg_html)
...@@ -73,6 +75,7 @@ sub generate_email { ...@@ -73,6 +75,7 @@ sub generate_email {
encoding => 'quoted-printable', encoding => 'quoted-printable',
}, },
body_str => $msg_html, body_str => $msg_html,
encode_check => Encode::FB_DEFAULT
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment