]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2006-02-04 03:24:12 by don]
authordon <>
Sat, 4 Feb 2006 11:24:12 +0000 (03:24 -0800)
committerdon <>
Sat, 4 Feb 2006 11:24:12 +0000 (03:24 -0800)
* Add back in the craptacular part of the MIME patch which was
   missing which is used to deal with MTAs like sendmail and exim4
   which eat from lines in message/rfc822 attachments for whatever
   reason.
 * Indicate in the changelog that this bug really does close #136654

Debbugs/MIME.pm
debian/changelog

index 5573dea81121ca167c3a6d5375d98b78509ef5e4..77201f543c039263e7975b80a1e41d18a9273ca2 100644 (file)
@@ -140,11 +140,30 @@ sub create_mime_message{
               $msg->attach(%{$attachment});
          }
          else {
+              # This is *craptacular*, but because various MTAs
+              # (sendmail and exim4, at least) appear to eat From
+              # lines in message/rfc822 attachments, we need to make
+              # sure the From line is the first thing in the
+              # attachement, not the second, so if it gets eaten, the
+              # headers don't collide into the body.
+              if (ref($attachment) eq 'ARRAY' and $attachment->[1] =~ /^From /) {
+                   # make a copy so that we don't screw up anything
+                   # that is expecting this arrayref to stay constant
+                   $attachment = [@{$attachment}];
+                   # flip the From and Received lines around
+                   @{$attachment}[qw(1 0)] = @{$attachment}[qw(0 1)];
+              }
+              elsif (not ref($attachment)) {
+                   # It's a scalar
+                   $attachment =~ s/^(Received:[^\n]+\n)(From [^\n]+\n)/$2$1/s;
+              }
               $msg->attach(Type => 'message/rfc822',
-                           Data => $attachment
+                           Data => $attachment,
+                           Encoding => '7bit',
                           );
          }
      }
+     print STDERR $msg->as_string;
      return $msg->as_string;
 }
 
index 251a975d8c05d63759cc37c37cc166644bc4595b..8a1e1a67bab5b95241c058e05a56f69f8ec9f00c 100644 (file)
@@ -100,6 +100,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low
     (closes: #321925)
     - Output proper charset for attachments (closes: #335813)
     - Use MIME encodings to attach messages in close and done.
+      (closes: #136654)
   
  -- Colin Watson <cjwatson@debian.org>  Fri, 20 Jun 2003 18:57:25 +0100