diff options
author | Petr Mladek <pmladek@suse.cz> | 2011-09-05 18:57:34 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2012-05-02 16:15:28 +0200 |
commit | 515f26384510701be0b3ef21ddd445d1022198cc (patch) | |
tree | f2498d94819efbe659d015d1f94953f7265a8ffa /sysui/desktop | |
parent | 0177cb3b4be0938f468074b732fc561378b3a914 (diff) |
better detect OASIS MIME types (bnc#711977)
check more elements; also set sub-class-of application/xml for Flat XML
Diffstat (limited to 'sysui/desktop')
-rwxr-xr-x | sysui/desktop/share/create_mime_xml.pl | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/sysui/desktop/share/create_mime_xml.pl b/sysui/desktop/share/create_mime_xml.pl index e1fc890ff181..5141dff069ce 100755 --- a/sysui/desktop/share/create_mime_xml.pl +++ b/sysui/desktop/share/create_mime_xml.pl @@ -45,9 +45,24 @@ foreach $component (sort(keys %mimehash)) { print (sort({customsort($a) cmp customsort($b)} @{$mimehash{$component}})); print ' <glob pattern="'.$glob.'"/>'; if ( $component =~ /oasis/ ) { - print ' <magic'.( $mimetype =~ /-/ ? ' priority="60"' : '').'>'; - print ' <match type="string" offset="38" value="'.$mimetype.'"/>'; - print ' </magic>'; + if ( $component =~ /flat-xml/ ) { + print ' <sub-class-of type="application/xml"/>'; + print ' <magic'.( $mimetype =~ /-/ ? ' priority="60"' : '').'>'; + print ' <match value="<?xml" type="string" offset="0">'; + print ' <match value="office:document" type="string" offset="4:100">'; + print ' <match value="office:mimetype="' . $mimetype . '"" 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>'; } |