]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1657496: correctly handle MIME type on single-part email (#126)
authorAli Alnubani <alialnu@mellanox.com>
Wed, 11 Jan 2023 04:49:11 +0000 (06:49 +0200)
committerGitHub <noreply@github.com>
Wed, 11 Jan 2023 04:49:11 +0000 (23:49 -0500)
Backported from 6765ab04774eebf8ea0bd063566240b24ac28f15.

Bugzilla/Mailer.pm

index 8bf94b2648199fa0b68f7ff6f53f0a645eec17db..0dd9d7e45a2293af4da233b1fcf925a176c522e4 100644 (file)
@@ -77,10 +77,10 @@ sub generate_email {
   }
 
   my $email = Bugzilla::MIME->new($msg_header);
-  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.