Red Hat Bugzilla – Bug 498671
file utility does not produce MIME type for XML files
Last modified: 2012-11-06 09:33:31 EST
Description of problem: I'd like to use `file' in a script to determine the MIME type of arbitrary files uploaded by a user. According to the man page I should be able to use "file -i filename". It works for most files such as text/plain, text/html, image/png, and application/x-zip, but when I give it an .xml file it comes up blank. Version-Release number of selected component (if applicable): file-4.17-15 How reproducible: Always. Steps to Reproduce: 1. Find or create an XML file. Simple test.xml: <?xml version="1.0" encoding="UTF-8"?></eof> 2. Run "file -i test.xml" Actual results: /tmp/test.xml: Expected results: /tmp/test.xml: text/xml Additional info: Without the -i option, `file' does correctly identify the file as "XML 1.0 document text". It just doesn't translate that into a MIME type.
Created attachment 406234 [details] mime type added
This request was evaluated by Red Hat Product Management for inclusion in the current release of Red Hat Enterprise Linux. Because the affected component is not scheduled to be updated in the current release, Red Hat is unfortunately unable to address this request at this time. Red Hat invites you to ask your support representative to propose this request, if appropriate and relevant, in the next release of Red Hat Enterprise Linux.
This request was erroneously denied for the current release of Red Hat Enterprise Linux. The error has been fixed and this request has been re-proposed for the current release.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Cause: Mime-type definitions were missing in magic file for some XML patterns. Consequence: File was not able to detect mime-type of XML files. Fix: Mime-type defitiones for XML files has been added. Result: File now detects mime-types for XML files.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0201.html