File Manager incorrect type - mime type capitalization issue?

ottdev

Well-Known Member
Oct 1, 2013
119
4
18
cPanel Access Level
Root Administrator
How does the File Manager determine the type ?
The Mime type for jpg appears to be okay.
Code:
# 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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
Hello :)

Could you verify which version of cPanel is installed on this system? EX:

Code:
cat /usr/local/cpanel/version
Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
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.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
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.
 

ottdev

Well-Known Member
Oct 1, 2013
119
4
18
cPanel Access Level
Root Administrator
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.
 
Last edited:

ottdev

Well-Known Member
Oct 1, 2013
119
4
18
cPanel Access Level
Root Administrator
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.]
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,241
363
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.