2

After installing WPS-Office the mime type for DOCX files is set to application/wps-office.docx (for instance the mime type reported by this command gio info document.docx is standard::content-type: application/wps-office.docx).

I have seen that the common solution is to edit the XML files in /usr/share/mime/packages/ (in this case remove the files WPS-Office added) and then run sudo update-desktop-database /usr/share/applications and sudo update-mime-database /usr/share/mime to update the respective databases and see the changes reflected in the following archives:

  • /usr/share/mime/globs
  • /usr/share/mime/globs2

This all seems to work as I see the content change from application/wps-office.docx to application/vnd.openxmlformats-officedocument.wordprocessingml.document.

But the command gio info document.docx keeps returning standard::content-type: application/wps-office.docx and the consequence is that when uploading office files to Google Drive those get the wrong mime type and are not recognized as valid Office files.

Is there another way to influence the mime type mapping so that gio info document.docx will start returning the correct mime type value (application/vnd.openxmlformats-officedocument.wordprocessingml.document)?

I want to keep WPS-Office installed...

1 Answer 1

5

Well actually the issue seem to be that WPS-Office is adding a ~/.local/share/mime/packages/Override.xml file and running update-mime-database

By deleting that file and adding common\do_not_detect_file_association_while_startup=true to ~/.config/Kingsoft/Office.conf and subsequently running sudo update-mime-database -V ~/.local/share/mime/ you can get rid of the bogus file association.

The only strange thing is the output of the command sudo update-mime-database -V ~/.local/share/mime/

Note that '~/.local/share' is not in the search path
set by the XDG_DATA_HOME and XDG_DATA_DIRS
environment variables, so applications may not
be able to find it until you set them. The
directories currently searched are:

- /root/.local/share
- /usr/local/share/
- /usr/share/

but the output of gio info document.docx is now correct: standard::content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

and the uploads to Google Drive are being correctly recognized as Word files.


References:
WPS office breaks mime (solved)
Add a custom MIME type for all users
Where are file associations stored?
XDG MIME Applications
Lubuntu 20.04 : problem with .docx file

1
  • 1
    Note to future readers, one needs to perform all the steps mentioned in both the question and this answer.
    – Ignatius
    Commented Sep 4, 2023 at 8:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .