From: ghendricks%novell.com <> Date: Tue, 6 Feb 2007 03:52:18 +0000 (+0000) Subject: Patch by Guzmán Brasó X-Git-Tag: bugzilla-2.22.3~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c606d52520d89f67ab4baa634917d27b84de209;p=thirdparty%2Fbugzilla.git Patch by Guzmán Brasó r=ghendricks, a=LpSolit --- diff --git a/importxml.pl b/importxml.pl index 2fc5ecc061..233253d3fd 100755 --- a/importxml.pl +++ b/importxml.pl @@ -1217,16 +1217,22 @@ Debug( "Reading xml", DEBUG_LEVEL ); local ($/); $xml = <>; -# If the email was encoded (BugMail::MessageToMTA() does it when using UTF-8), -# we have to decode it first, else the XML parsing will fail. -my $parser = MIME::Parser->new; -$parser->output_to_core(1); -$parser->tmp_to_core(1); -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) +# If there's anything besides whitespace before new; + $parser->output_to_core(1); + $parser->tmp_to_core(1); + 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; Debug( "Parsing tree", DEBUG_LEVEL );