Subject: | Convert::TNEF Bug? |
Date: | Fri, 20 Jul 2012 11:35:31 +0200 |
To: | <dougw [...] cpan.org>, <bug-Convert-TNEF [...] rt.cpan.org> |
From: | "Peter Gander" <p.gander [...] schmidlinag.ch> |
Hello,
first of all: Thank you for putting much time and energy into programming / maintaining this site!
I'm using Convert::TNEF in a Perl-Script to read the Attachments. Since som time ago, we had an increasing
amount of issues where Convert::TNEF didn't tell the whole name of the attached file(s).
Therefore I was debugging and found out, that some of the (probably newer) Outlookmails have a different
Hex-ID (I don't know exactly what it is J) to refere to the name of the attached file.
Here's what I had to change (1 line only) to make it work again for all of the 1600 tested mails:
sub longname {
my $self = shift;
my $data = $self->data("Attachment");
return unless $data;
my $pos = index( $data, pack( "H*", "1e00013001" ) );
$pos = index( $data, pack( "H*", "1e00073701" )) if($pos < 0); #seems that later outlook versions have a different id P. Gander
return $self->name unless $pos >= 0;
my $len = unpack( "V", substr( $data, $pos + 8, 4 ) );
my $longname = substr( $data, $pos + 12, $len );
$longname =~ s/\x00+$// if $longname;
return $longname || $self->name;
}
In the debugger I was able to analyse the Hex data and recognized that the Filename was there but under a different
search Hex-ID.
God bles You
Peter