Kaydet (Commit) 515f2638 authored tarafından Petr Mladek's avatar Petr Mladek

better detect OASIS MIME types (bnc#711977)

check more elements; also set sub-class-of application/xml for Flat XML
üst 0177cb3b
...@@ -45,9 +45,24 @@ foreach $component (sort(keys %mimehash)) { ...@@ -45,9 +45,24 @@ foreach $component (sort(keys %mimehash)) {
print (sort({customsort($a) cmp customsort($b)} @{$mimehash{$component}})); print (sort({customsort($a) cmp customsort($b)} @{$mimehash{$component}}));
print ' <glob pattern="'.$glob.'"/>'; print ' <glob pattern="'.$glob.'"/>';
if ( $component =~ /oasis/ ) { if ( $component =~ /oasis/ ) {
print ' <magic'.( $mimetype =~ /-/ ? ' priority="60"' : '').'>'; if ( $component =~ /flat-xml/ ) {
print ' <match type="string" offset="38" value="'.$mimetype.'"/>'; print ' <sub-class-of type="application/xml"/>';
print ' </magic>'; print ' <magic'.( $mimetype =~ /-/ ? ' priority="60"' : '').'>';
print ' <match value="&lt;?xml" type="string" offset="0">';
print ' <match value="office:document" type="string" offset="4:100">';
print ' <match value="office:mimetype=&quot;' . $mimetype . '&quot;" type="string" offset="100:4000"/>';
print ' </match>';
print ' </match>';
print ' </magic>';
} else {
print ' <magic'.( $mimetype =~ /-/ ? ' priority="60"' : '').'>';
print ' <match value="PK\003\004" type="string" offset="0">';
print ' <match value="mimetype" type="string" offset="30">';
print ' <match value="' . $mimetype . '" type="string" offset="38"/>';
print ' </match>';
print ' </match>';
print ' </magic>';
}
} }
print ' </mime-type>'; print ' </mime-type>';
} }
......
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