Subject: | couple things |
Here is a patch that fixes a couple issues I've had in using this module:
At least one mailer (Pine) sets the content-type to 'TEXT/PLAIN' instead
of text/plain. I made the regex case insensitive so that those mime
parts don't get detached.
Also -- and this is probably related to the above problem -- I've had
instances where all parts of a message get detached, leaving no body
(parts_set gets called with an empty array). I found that for my
purposes when this happens, I would like to just pass the original
message through... just to be safe.
Regards,
Jeremy Parrish
Subject: | Stripper.patch |
--- Email-MIME-Attachment-Stripper-1.31/lib/Email/MIME/Attachment/Stripper.pm 2004-12-23 15:47:05.000000000 -0600
+++ Stripper.pm 2006-06-19 14:41:16.000000000 -0500
@@ -107,11 +107,15 @@
my $dp = $_->header('Content-Disposition') || 'inline';
push(@keep, $_) and next
- if $ct =~ m[text/plain] && $dp =~ /inline/;
+ # ignore case added by JP
+ if $ct =~ m[text/plain]i && $dp =~ /inline/i;
push @attach, $_;
$self->_detach_all($_) if $_->parts > 1;
}
- $part->parts_set(\@keep);
+ # if added by JP
+ if(@keep) {
+ $part->parts_set(\@keep);
+ }
push @{$self->{attach}}, map {
my $content_type = parse_content_type($_->content_type);
{