From: Dave Miller Date: Thu, 29 Aug 2024 11:01:23 +0000 (-0400) Subject: Bug 1880288: Noncharacters in comments cause bugmail sending to fail X-Git-Tag: bugzilla-5.3.3~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2a91862177cd008e2963b4e349e99f55f1851ea3;p=thirdparty%2Fbugzilla.git Bug 1880288: Noncharacters in comments cause bugmail sending to fail --- diff --git a/Bugzilla/MIME.pm b/Bugzilla/MIME.pm index 33b51e1c2..dd6aeaedf 100644 --- a/Bugzilla/MIME.pm +++ b/Bugzilla/MIME.pm @@ -13,7 +13,7 @@ use 5.14.0; use parent qw(Email::MIME); sub new { - my ($class, $msg) = @_; + my ($class, $msg, $args) = @_; # Template-Toolkit trims trailing newlines, which is problematic when # parsing headers. @@ -52,7 +52,7 @@ sub new { # you're running on. See http://perldoc.perl.org/perlport.html#Newlines $msg =~ s/(?:\015+)?\012/\015\012/msg; - return $class->SUPER::new($msg); + return $class->SUPER::new($msg, $args); } sub as_string { @@ -113,7 +113,7 @@ workarounds. =head1 SYNOPSIS use Bugzilla::MIME; - my $email = Bugzilla::MIME->new($message); + my $email = Bugzilla::MIME->new($message, $args); =head1 DESCRIPTION diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 0dd9d7e45..5bb2b7747 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -21,6 +21,7 @@ use Bugzilla::MIME; use Bugzilla::User; use Bugzilla::Util; +use Encode qw() use Date::Format qw(time2str); use Email::Sender::Simple qw(sendmail); @@ -61,6 +62,7 @@ sub generate_email { encoding => 'quoted-printable', }, body_str => $msg_text, + encode_check => Encode::FB_DEFAULT )); if ($templates->{html} && $email_format eq 'html') { $template->process($templates->{html}, $vars, \$msg_html) @@ -73,6 +75,7 @@ sub generate_email { encoding => 'quoted-printable', }, body_str => $msg_html, + encode_check => Encode::FB_DEFAULT ); }