From fc6b914f9fac7b7902c8cfffd3ee36e820099456 Mon Sep 17 00:00:00 2001 From: don <> Date: Sat, 4 Feb 2006 03:24:12 -0800 Subject: [PATCH] [project @ 2006-02-04 03:24:12 by don] * 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 | 21 ++++++++++++++++++++- debian/changelog | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Debbugs/MIME.pm b/Debbugs/MIME.pm index 5573dea..77201f5 100644 --- a/Debbugs/MIME.pm +++ b/Debbugs/MIME.pm @@ -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; } diff --git a/debian/changelog b/debian/changelog index 251a975..8a1e1a6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Fri, 20 Jun 2003 18:57:25 +0100 -- 2.39.2