File Manager incorrect type - mime type capitalization issue?
How does the File Manager determine the type ?
The Mime type for jpg appears to be okay.
In a browser, looking at a "fancyIndex", the exact same file named as logo.jpg and logo.JPG in both instances shows an image icon as expected. In File Manager, logo.jpg shows an image icon and type image/x-generic logo.JPG shows up incorrectly as text/x-generic however Mime types are supposed to be case-insensitive.
# grep -i jpg /usr/local/apache/conf/mime.types
image/jpeg jpeg jpg jpe
In a browser, looking at a "fancyIndex", the exact same file named as logo.jpg and logo.JPG in both instances shows an image icon as expected. In File Manager, logo.jpg shows an image icon and type image/x-generic logo.JPG shows up incorrectly as text/x-generic however Mime types are supposed to be case-insensitive.
-
Hello :) Could you verify which version of cPanel is installed on this system? EX: cat /usr/local/cpanel/version
Thank you.0 -
11.54.0.21 0 -
Hello :) I've reproduced the behavior you have reported, and opened internal case CPANEL-5432 to address the issue. There's currently no specific time frame on a resolution, but I will update this thread with more information as it becomes available. Thank you. 0 -
Hello :) To update, the reported behavior is by design, as case sensitivity is important on a Unix environment. For instance, "example.c" is a C file, but "example.C" is a C++ file. Thank you. 0 -
Back to my original question then - Where is the file manager obtaining this info from ? Is it reading from mime.types ? # grep -i jpg /usr/local/apache/conf/mime.types image/jpeg jpeg jpg jpe Then presumably, that file needs to have all the capitalized versions of file extensions added in ? ( Despite Apache docs stating = case-insensitive ? ) text/x-c c cc cxx cpp h hh dic C does not even appear in the mime.types file, so you'd still be getting it wrong per your example. 0 -
Back to my original question then - Where is the file manager obtaining this info from ? Is it reading from mime.types ? # grep -i jpg /usr/local/apache/conf/mime.types image/jpeg jpeg jpg jpe Then presumably, that file needs to have all the capitalized versions of file extensions added in ? ( Despite Apache docs stating = case-insensitive ? )
There are not too many applications that differentiate the case of their extensions -are there other common ones than 'C' ? If the file manager is defaulting when it doesn't find the case-sensitive match, could that logic not be changed ? - check for case-sensitive match -> if not found, default to X -check for case-sensitive match -> if not found, check for case-insensitive match -> if not found, default to X Far more people working with files named HTML, JPG, GIF, etc.. than are working with C++; Your mention of c vs C is the first I have ever heard of case being an issue in determining how to treat a file. [notwithstanding case-sensitivity on most file systems except Windows, but we aren't talking about determining if a file already exists or not.]0 -
Hello :) It's important to keep in mind that File Manager is showing you files stored on the Linux filesystem, as opposed to Apache that's showing you files served by the Apache web server. These are two separate interfaces and the method of determining the file type is unrelated. File manager determines the file type through internal cPanel scripts (e.g. /usr/local/cpanel/Cpanel/Fileman/Mime.pm). That said, I encourage you to open a feature request if you would like to see a change in how file manager determines the file type for specific extensions: Submit A Feature Request Thank you. 0
Please sign in to leave a comment.
Comments
7 comments