summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-12-10 15:47:48 +0000
committerBen Hutchings <ben@decadent.org.uk>2019-12-10 15:47:48 +0000
commit0349a3dfcd93c0e7be6f38f5ab373fcef1150bf0 (patch)
treeb6608583d70ab56c98443a32332a12dfdd4f73ed
parentc132360db41fd950ea3ecb84c200e4fb05af447c (diff)
downloadlinux-stable-queue-0349a3dfcd93c0e7be6f38f5ab373fcef1150bf0.tar.gz
mime_entity_to_mbox: Fix "From "-escaping
* It was dropping the space in the replacement text * It didn't actually enable QP encoding as required
-rw-r--r--scripts/LinuxStableQueue.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/LinuxStableQueue.pm b/scripts/LinuxStableQueue.pm
index 20e895dc..d5cf5b3b 100644
--- a/scripts/LinuxStableQueue.pm
+++ b/scripts/LinuxStableQueue.pm
@@ -123,18 +123,20 @@ sub common_mail_header {
sub mime_entity_to_mbox {
my ($entity, $mbox_fh) = @_;
- for my $i (0 .. $entity->parts - 1) {
- my $part = $entity->parts($i);
+ for my $part ($entity->parts || $entity) {
if ($part->as_string =~ /^From /m) {
- # We have to use QP and escape this later
- $part->head->add(Encoding => 'quoted-printable');
+ # We have to use QP and escape this later. The as_string
+ # method will take care of escaping everything else as
+ # needed for QP.
+ $part->head->replace('Content-Transfer-Encoding',
+ 'quoted-printable');
}
}
# Escape 'From ' within the message and ensure are at least two '\n'
# before the 'From ' of the next message
my $text = $entity->as_string;
- $text =~ s/^From /=46rom/gm;
+ $text =~ s/^From /=46rom /gm;
while ($text !~ /\n\n$/) {
$text .= "\n";
}