From: Brion Vibber Date: Tue, 5 Feb 2008 22:35:28 +0000 (+0000) Subject: Fix for XML type checks... don't look for the closing angle-brace on the root tag... X-Git-Tag: 1.31.0-rc.0~49592 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=839871e486723f775771d4621c32e75ec329a3f7;p=lhc%2Fweb%2Fwiklou.git Fix for XML type checks... don't look for the closing angle-brace on the root tag, as it may not be in the header chunk we read. Some SVGs have a lot of attributes on the root element! --- diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index e144f7c0d5..90009f5fea 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -479,11 +479,11 @@ class MimeMagic { $head, $match ) ) { $doctype = $match[1]; } - if ( preg_match( '%<(\w+).*>%sim', $head, $match ) ) { + if ( preg_match( '%<(\w+)\b%si', $head, $match ) ) { $tag = $match[1]; } - #print "
ANALYSING $file ($mime): doctype= $doctype; tag= $tag
"; + #print "
ANALYSING $file: doctype= $doctype; tag= $tag
"; if ( strpos( $doctype, "-//W3C//DTD SVG" ) === 0 ) { return "image/svg+xml";