PCManFM confused about MIME types

The dedicated forum for PCMan File Manager - http://wiki.lxde.org/en/PCManFM
hughtmccullough
Posts: 1
Joined: Thu Apr 03, 2014 11:46 am

PCManFM confused about MIME types

Postby hughtmccullough » Thu Apr 03, 2014 3:48 pm

The people on the LXLE forum weren't able to help me with this one and I thought I would try here.

Recently PCManFM has stopped recognising MIME types correctly. For example, it thinks .docx files are application/zip files and gives them a zip icon. As it also detects .zip files as application/zip, 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 there 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.

As recommended on the LXLE forum, I installed assogiate to try to see what was going on. 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 user modifications that could haved been causing problems. 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 (PK\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 is ignoring the 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?

Also, I am suspicious that Kingsoft Office, which I installed recently, may have started this problem. It has placed an XML file in /usr/share/mime/packages claiming the openXML files for itself with its own set of MIME types. Would it be safe to edit this file?

How does PCManFM decide the type of a file? Is there a configuration setting that tells it either to use or to ignore file extensions? Is it ignoring the file extension because there is too much ambiguity about the open XML file extensions in the MIME database?

I am using LXLE 12.04 and PCManFM is v1.0.1. I am now going round in circles and would appreciate any help to break out!

linuxliveuser
Posts: 1
Joined: Mon Jun 23, 2014 3:05 pm

Re: PCManFM confused about MIME types

Postby linuxliveuser » Mon Jun 23, 2014 3:29 pm

Got some PCManFM confusion too (using Porteus 3.0 with LXDE):
1) m3u playlist file was opened as text file, until I inserted "#EXTM3U" as first line.
2) Although plain text files were defined to be opened with geany, conf files were opened with leafpad.
~/.local/share/applications/mimeapps.list says [Default Applications] text/plain=geany.desktop
After PCManFM "open with" geany, mimeapps.list says: [Added Associations] text/plain=geany.desktop
Now a conf file is opened with geany. Confusion remains.

LStranger
Posts: 49
Joined: Sat Nov 05, 2011 5:48 pm

Re: PCManFM confused about MIME types

Postby LStranger » Fri Aug 22, 2014 10:09 pm

About MIME types - what is shown when you open Properties window on those problematic files?
PCManFM decides file type using GLib procedures - at first it tries to recognize file type using just a file name and if that fails then it loads chunk of the file and asks GLib to recognize type of data in that chunk. No own diagnostics, only GLib functions. If that doesn't work then that should be investigated as it is a serious problem. I've pushed some fix into GIT few moments ago, try it if you can and tell the results, please.

s7dhansh
Posts: 2
Joined: Wed Sep 03, 2014 5:48 am

Re: PCManFM confused about MIME types

Postby s7dhansh » Wed Sep 03, 2014 5:54 am

Built the latest pcmanfm source from git. Issue unresolved.

LStranger
Posts: 49
Joined: Sat Nov 05, 2011 5:48 pm

Re: PCManFM confused about MIME types

Postby LStranger » Sun Sep 07, 2014 7:59 pm

Are you sure you have latest LibFM from GIT too? Last fixes on that issue was on September 1st. It shows my .m3u and .m3u8 files as playlists. Check that, please.

s7dhansh
Posts: 2
Joined: Wed Sep 03, 2014 5:48 am

Re: PCManFM confused about MIME types

Postby s7dhansh » Sat Sep 27, 2014 8:19 am

Sorry for the late reply.

Yes I did. It still isn't showing docx, xlsx etc. files with correct MIME Types. Just assumes them to be zip files.

jvfiel
Posts: 1
Joined: Wed Feb 04, 2015 8:40 am

Re: PCManFM confused about MIME types

Postby jvfiel » Wed Feb 04, 2015 8:51 am

same problem. Is it possible to change PCManFM with another file manager (temporarily)?

LStranger
Posts: 49
Joined: Sat Nov 05, 2011 5:48 pm

Re: PCManFM confused about MIME types

Postby LStranger » Sat May 09, 2015 11:18 am

Thank you very much for bringing it to attention. I hope this issue is fixed recently in the libfm GIT repository. Try it when possible, please, and let us know if something is still not fixed.


Return to “PCManFM”

Who is online

Users browsing this forum: No registered users and 1 guest