From: Dave Miller Date: Thu, 29 Aug 2024 11:04:46 +0000 (-0400) Subject: Bug 1880288: Noncharacters in comments cause bugmail sending to fail X-Git-Tag: bugzilla-5.2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee9cf0026b35df50a8070dff0aea609c35213910;p=thirdparty%2Fbugzilla.git Bug 1880288: Noncharacters in comments cause bugmail sending to fail Co-authored-by: Frédéric Buclin --- diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 3ab971613..3fd00d5c4 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -21,6 +21,7 @@ use Bugzilla::Mailer; use Bugzilla::Hook; use Bugzilla::MIME; +use Encode qw(); use Date::Parse; use Date::Format; use Scalar::Util qw(blessed); @@ -478,6 +479,7 @@ sub _generate_bugmail { encoding => 'quoted-printable', }, body_str => $msg_text, + encode_check => Encode::FB_DEFAULT )); if ($user->setting('email_format') eq 'html') { @@ -491,6 +493,7 @@ sub _generate_bugmail { encoding => 'quoted-printable', }, body_str => $msg_html, + encode_check => Encode::FB_DEFAULT ); } diff --git a/Bugzilla/MIME.pm b/Bugzilla/MIME.pm index 065166da2..08ec0b0c7 100644 --- a/Bugzilla/MIME.pm +++ b/Bugzilla/MIME.pm @@ -14,7 +14,7 @@ use warnings; use base qw(Email::MIME); sub new { - my ($class, $msg) = @_; + my ($class, $msg, $args) = @_; state $use_utf8 = Bugzilla->params->{'utf8'}; # Template-Toolkit trims trailing newlines, which is problematic when @@ -54,7 +54,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 1cd70b1e2..427b0f9ea 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -21,6 +21,7 @@ use Bugzilla::MIME; use Bugzilla::Util; use Bugzilla::User; +use Encode qw(); use Date::Format qw(time2str); use Email::Sender::Simple qw(sendmail); @@ -62,6 +63,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) @@ -74,6 +76,7 @@ sub generate_email { encoding => 'quoted-printable', }, body_str => $msg_html, + encode_check => Encode::FB_DEFAULT ); }