PCManFM confuses MIME types docx and zip
  • Recently PCManFM has stopped recognising MIME types correctly.  For example, it thinks application/msword .docx files are application/zip files and both file types have the zip icon.  Therefore, if I select a default application for .docx files, this becomes the default application for .zip files and vice versa.

    I have checked the various MIME types and defaults files and they all seem OK.  The problem is further back than that because PCManFM thinks these files are all of the MIME type application/zip.  I checked in a terminal using "file --mime-type" on a large number of .docx and .zip files and it reports the MIME types correctly.

    There are some other anomalies such as some .doc files which have MIME
    type application/msword being reported as OLE2 compound document but I am concentrating on the .docx/.zip problem and hoping the others will be related.

    I am aware of a bug about five years ago that was similar to this but it was supposed to be fixed back then.  How does PCManFM decide the type of a file?  Does it use the file extension or does it look deeper for the MIME type?  Is there a configuration file that determines this?  Is this still a bug or should I be able to solve it and, if so, where do I look?  Is this documented somewhere?  The documentation I have found so far assumes that the MIME types are correctly identified.

    I am using LXLE 12.04 and PCManFM is v1.0.1.
  • lxlelxle
    PMPosts: 2,656
    Menu>System Tools>Alternatives Configurator
  • Thanks for the reply but I can't for the life of me see how this tool tells me why PCManFM thinks my .docx files are MIME type application/zip when they are actually MIME type application/msword.

    Could you please elaborate for me?
  • lxlelxle
    PMPosts: 2,656
    Sorry it used to be in there, they must have moved it or removed it entirely from there. Looks like you'll want to install a mime file type editor

    Do a search in synaptic for 'assogiate'

    should appear in your menu's after you install, if it doesn't use run to launch it, by typing

    assogiate

    should be able to edit all your mime file types from there.
  • Well, this suggestion has certainly kept me occupied.  Assogiate, in conjunction with another tool called bless, has allowed me to investigate quite a bit.  However, the problem remains as PCManFM doesn't seem to make good use of the MIME type database. 

    If instead I use Gnome Commander, all of the files I have tried so far are correctly identified.  The problem there is that I can't change the default applications.  If I click on the "change" button, nothing happens. 

    In assogiate, when I first looked, all of the file types in the database were in the "standard" database with no modifications.  As mentioned above, PCManFM's interpretation of the database information was that all open XML file were zip files.  I tried to coax PCManFM to identify a .docx file correctly by putting "application/zip" in the "parent type" box but this didn't work.  I noticed that the "application/zip" entry listed the initial string in the file (PX\003\004) under "file contents" with a weight of 40.  I tried doing this with the .docx type and this resulted in it being identified correctly in PCManFM but then all of the open XML files (.docx, .pptx, .xlsx etc) were identified in PCManFM as .docx files.  This was true whether I left them as they were or included the same string under "file contents" for each of them.

    Clearly PCManFM ignores file extensions and I can find no other way to get it to differentiate between the different open XML types.  When  I look at the files in bless there is no hex sequence that is common to ALL .docx files and doesn't appear in ANY of the other open XML formats.

    Am I going the right way about this?  Can anyone explain why PCManFM is ignoring file extensions?  I noticed that Libre Office has a file in /usr/share/application-registry and the list of files that it identifies with Libre Office includes all of the open XML ones.  Could this be encouraging PCManFM to think that all of the types are the same?  Is it safe to edit this file or will it just be changed back by Libre Office?  Should I try to insert one for each of the open XML formats?

    As you can probably see, I don't really know what I am doing here and it would make my life a lot easier if someone could point me in the right direction instead of me blundering around blindly.