patch by Guzm��n Bras��

r=ghendricks, a=LpSolit
This commit is contained in:
ghendricks%novell.com 2007-02-05 19:55:45 +00:00
Родитель 49a73ff19a
Коммит 5d5f2586ff
1 изменённых файлов: 15 добавлений и 9 удалений

Просмотреть файл

@ -1178,6 +1178,10 @@ Debug( "Reading xml", DEBUG_LEVEL );
local ($/);
$xml = <>;
# If there's anything except whitespace before <?xml then we guess it's a mail
# and MIME::Parser should parse it. Else don't.
if ($xml =~ m/\S.*<\?xml/s ) {
# If the email was encoded (Mailer::MessageToMTA() does it when using UTF-8),
# we have to decode it first, else the XML parsing will fail.
my $parser = MIME::Parser->new;
@ -1187,7 +1191,9 @@ my $entity = $parser->parse_data($xml);
my $bodyhandle = $entity->bodyhandle;
$xml = $bodyhandle->as_string;
# remove everything in file before xml header (i.e. remove the mail header)
}
# remove everything in file before xml header
$xml =~ s/^.+(<\?xml version.+)$/$1/s;
Debug( "Parsing tree", DEBUG_LEVEL );