Commit e0f4e652 authored by ghendricks%novell.com's avatar ghendricks%novell.com

patch by Guzmán Brasó

r=ghendricks, a=LpSolit
parent e4ec2589
...@@ -1178,16 +1178,22 @@ Debug( "Reading xml", DEBUG_LEVEL ); ...@@ -1178,16 +1178,22 @@ Debug( "Reading xml", DEBUG_LEVEL );
local ($/); local ($/);
$xml = <>; $xml = <>;
# If the email was encoded (Mailer::MessageToMTA() does it when using UTF-8), # If there's anything except whitespace before <?xml then we guess it's a mail
# we have to decode it first, else the XML parsing will fail. # and MIME::Parser should parse it. Else don't.
my $parser = MIME::Parser->new; if ($xml =~ m/\S.*<\?xml/s ) {
$parser->output_to_core(1);
$parser->tmp_to_core(1); # If the email was encoded (Mailer::MessageToMTA() does it when using UTF-8),
my $entity = $parser->parse_data($xml); # we have to decode it first, else the XML parsing will fail.
my $bodyhandle = $entity->bodyhandle; my $parser = MIME::Parser->new;
$xml = $bodyhandle->as_string; $parser->output_to_core(1);
$parser->tmp_to_core(1);
# remove everything in file before xml header (i.e. remove the mail header) my $entity = $parser->parse_data($xml);
my $bodyhandle = $entity->bodyhandle;
$xml = $bodyhandle->as_string;
}
# remove everything in file before xml header
$xml =~ s/^.+(<\?xml version.+)$/$1/s; $xml =~ s/^.+(<\?xml version.+)$/$1/s;
Debug( "Parsing tree", DEBUG_LEVEL ); Debug( "Parsing tree", DEBUG_LEVEL );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment