The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

File Manager incorrect type - mime type capitalization issue?

Discussion in 'Workarounds and Optimization' started by ottdev, Mar 13, 2016.

  1. ottdev

    ottdev Well-Known Member

    Joined:
    Oct 1, 2013
    Messages:
    63
    Likes Received:
    1
    Trophy Points:
    8
    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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. ottdev

    ottdev Well-Known Member

    Joined:
    Oct 1, 2013
    Messages:
    63
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    11.54.0.21
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  6. ottdev

    ottdev Well-Known Member

    Joined:
    Oct 1, 2013
    Messages:
    63
    Likes Received:
    1
    Trophy Points:
    8
    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.
     
    #6 ottdev, Apr 11, 2016
    Last edited: Apr 11, 2016
  7. ottdev

    ottdev Well-Known Member

    Joined:
    Oct 1, 2013
    Messages:
    63
    Likes Received:
    1
    Trophy Points:
    8
    cPanel Access Level:
    Root Administrator
    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.]
     
    #7 ottdev, Apr 11, 2016
    Last edited: Apr 11, 2016
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page