Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: spleen.leveller [...] gmail.com
Cc:
AdminCc:

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



Subject: MIME::Parser set wrong mimetype for empty entities
When parsing a mail containing a completely empty MIME part (just the repetition of two boundaries) MIME::Parser returns an entity. When calling the method mime_type on such entity I get as a result the string "text/plain; charset=us-ascii" instead of the expected "text/plain".
Subject: Re: [rt.cpan.org #35369] MIME::Parser set wrong mimetype for empty entities
Date: Thu, 24 Apr 2008 08:46:50 -0400
To: bug-MIME-tools [...] rt.cpan.org
From: "David F. Skoll" <dfs [...] roaringpenguin.com>
Hi, Michele, Show quoted text
> When parsing a mail containing a completely empty MIME part (just the > repetition of two boundaries) MIME::Parser returns an entity. When > calling the method mime_type on such entity I get as a result the > string "text/plain; charset=us-ascii" instead of the > expected "text/plain".
Thanks for your bug report. We've fixed it in our repository. A patch is included below for your convenience. Regards, David. diff --git a/lib/MIME/Parser.pm b/lib/MIME/Parser.pm index f691d6b..a0ff765 100644 --- a/lib/MIME/Parser.pm +++ b/lib/MIME/Parser.pm @@ -1051,7 +1051,7 @@ sub process_part { if (not defined $head) { $self->debug("bogus empty part"); $head = $self->interface('HEAD_CLASS')->new; - $head->mime_type('text/plain; charset=US-ASCII'); + $head->mime_type('text/plain'); $ent->head($head); $ent->bodyhandle($self->new_body_for($head)); $ent->bodyhandle->open("w")->close or die "$ME: can't close: $!";