Score:1

WPS-Office messing up mime types associated with Office documents

vn flag

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...

Score:1
vn flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.