Skip Menu |

This queue is for tickets about the MIME-tools CPAN distribution.

Report information
The Basics
Id: 60931
Status: resolved
Priority: 0/
Queue: MIME-tools

People
Owner: dmo+pause [...] dmo.ca
Requestors: dietmar [...] proxmox.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: empty preamble bug
Date: Wed, 1 Sep 2010 08:43:12 +0000
To: "bug-MIME-tools [...] rt.cpan.org" <bug-MIME-tools [...] rt.cpan.org>
From: Dietmar Maurer <dietmar [...] proxmox.com>
Hi all, when I parse a simple multipart message like: ------------------------------------------------ MIME-Version: 1.0 Received: by 10.220.78.157 with HTTP; Thu, 26 Aug 2010 21:33:17 -0700 (PDT) Content-Type: multipart/alternative; boundary=90e6ba4fc6ea25d329048ec69d99 --90e6ba4fc6ea25d329048ec69d99 Content-Type: text/plain; charset=ISO-8859-1 HELLO --90e6ba4fc6ea25d329048ec69d99 Content-Type: text/html; charset=ISO-8859-1 HELLO<br> --90e6ba4fc6ea25d329048ec69d99-- ------------------------------------------------- and the call $entity->print(\*STDOUT) I get: ------------------------------------------------ MIME-Version: 1.0 Received: by 10.220.78.157 with HTTP; Thu, 26 Aug 2010 21:33:17 -0700 (PDT) Content-Type: multipart/alternative; boundary=90e6ba4fc6ea25d329048ec69d99 --90e6ba4fc6ea25d329048ec69d99 Content-Type: text/plain; charset=ISO-8859-1 HELLO ... ------------------------------------------------- Please note the additional line before the first boundary. The following patch corrects that behavior: Index: src/lib/MIME/Entity.pm =================================================================== --- src.orig/lib/MIME/Entity.pm 2010-09-01 10:26:31.000000000 +0200 +++ src/lib/MIME/Entity.pm 2010-09-01 10:32:50.000000000 +0200 @@ -1793,8 +1793,14 @@ my $boundary = $self->head->multipart_boundary; ### Preamble: - my $preamble = join('', @{ $self->preamble || $DefPreamble }); - $out->print("$preamble\n") if ($preamble ne '' or $self->preamble); + if (defined(my $plines = $self->preamble)) { + if (scalar(@$plines)) { + my $preamble = join('', @$plines); + $out->print("$preamble\n"); + } + } else { + $out->print("$DefPreamble\n"); + } ### Parts: my $part; - Dietmar
Subject: RE: [rt.cpan.org #60931] AutoReply: empty preamble bug
Date: Wed, 1 Sep 2010 10:14:34 +0000
To: "bug-MIME-tools [...] rt.cpan.org" <bug-MIME-tools [...] rt.cpan.org>
From: Dietmar Maurer <dietmar [...] proxmox.com>
here is a better patch: Index: src/lib/MIME/Entity.pm =================================================================== --- src.orig/lib/MIME/Entity.pm 2006-03-17 22:15:49.000000000 +0100 +++ src/lib/MIME/Entity.pm 2010-09-01 11:42:06.000000000 +0200 @@ -1793,8 +1793,15 @@ my $boundary = $self->head->multipart_boundary; ### Preamble: - my $preamble = join('', @{ $self->preamble || $DefPreamble }); - $out->print("$preamble\n") if ($preamble ne '' or $self->preamble); + if (defined(my $plines = $self->preamble)) { + if (scalar(@$plines)) { + my $preamble = join('', @$plines); + $out->print("$preamble\n"); + } + } else { + my $preamble = join('', @$DefPreamble); + $out->print("$preamble\n"); + } ### Parts: my $part;
Thanks for the patch. I've applied it in a slightly modified form, and it will be in the next release.
Fixed in 5.500.