Hi, Kevin,
This patch seems to work for me. Please give it a try.
Regards,
Dianne.
commit 16e52b624dd70714cbbb05fcca466c0c788478e8
Author: Dianne Skoll <dfs@roaringpenguin.com>
Date: Wed Jun 24 10:14:49 2015 -0400
Fix for RT CPAN #105455
diff --git a/lib/MIME/Field/ParamVal.pm b/lib/MIME/Field/ParamVal.pm
index 19d8b45..1a9cbd2 100644
--- a/lib/MIME/Field/ParamVal.pm
+++ b/lib/MIME/Field/ParamVal.pm
@@ -103,7 +103,7 @@ my $TSPECIAL = '()<>@,;:\</[]?="';
#" Fix emacs highlighting...
-my $TOKEN = '[^ \x00-\x1f\x80-\xff' . "\Q$TSPECIAL\E" . ']+';
+my $TOKEN = '[^\x00-\x1f\x80-\xff' . "\Q$TSPECIAL\E" . ']+';
my $QUOTED_STRING = '"([^\\\\"]*(?:\\\\.(?:[^\\\\"]*))*)"';
@@ -251,6 +251,9 @@ sub parse_params {
# Strip leading/trailing whitespace from badtoken
$badtoken =~ s/^\s+//;
$badtoken =~ s/\s+\z//;
+
+ # Strip anything after a space - CPAN RT #105455
+ $badtoken =~ s/\s.*//;
}
$val = defined($qstr) ? $qstr :
(defined($enctoken) ? $enctoken :
diff --git a/t/ParamVal.t b/t/ParamVal.t
index 824cd38..4990ff3 100644
--- a/t/ParamVal.t
+++ b/t/ParamVal.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More tests => 9;
use MIME::Field::ContType;
use MIME::WordDecoder;
@@ -34,3 +34,20 @@ use Encode;
is( encode('utf8', $wd->decode($field->param('answer'))), $expected, 'answer param was unpacked correctly');
}
+
+# Test for CPAN RT #105455
+{
+ my $header = 'attachment; filename=wookie.zip size=3';
+
+ my $field = Mail::Field->new('Content-type');
+ $field->parse( $header );
+ is( $field->param('_'), 'attachment', 'Got body of header');
+ is ($field->param('filename'), 'wookie.zip', 'Got correct filename');
+
+ $header = 'attachment; filename="wookie.zip size=3"';
+
+ $field = Mail::Field->new('Content-type');
+ $field->parse( $header );
+ is( $field->param('_'), 'attachment', 'Got body of header');
+ is ($field->param('filename'), 'wookie.zip size=3', 'Got correct filename');
+}