]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1657496: correctly handle MIME type on single-part email. r=eseyman, a=justdave
authorDave Miller <github@justdave.net>
Thu, 16 Dec 2021 23:44:27 +0000 (18:44 -0500)
committerDave Miller <github@justdave.net>
Thu, 16 Dec 2021 23:44:27 +0000 (18:44 -0500)
Bugzilla/BugMail.pm

index 5a2c9b788e03b71afcb96648c682736d5686b4a2..644ed1f1cf7bb3099788042ed1628653dd279afe 100644 (file)
@@ -387,9 +387,10 @@ sub _generate_bugmail {
 
     # TT trims the trailing newline, and threadingmarker may be ignored.
     my $email = new Email::MIME("$msg_header\n");
-    if (scalar(@parts) == 1) {
-        $email->content_type_set($parts[0]->content_type);
-    } else {
+
+    # If there's only one part, we don't need to set the overall content type
+    # because Email::MIME will automatically take it from that part (bug 1657496)
+    if (scalar(@parts) > 1) {
         $email->content_type_set('multipart/alternative');
         # Some mail clients need same encoding for each part, even empty ones.
         $email->charset_set('UTF-8') if Bugzilla->params->{'utf8'};