安装WPS之后,将DOCX文件的mime类型设置为application/wps-office.docx
(例如,此命令gio info document.docx
报告的mime类型为standard::content-type: application/wps-office.docx
)。
我已经看到,常见的解决方案是编辑/usr/share/mime/packages/
中的XML文件(在本例中,删除respective添加的文件),然后运行sudo update-desktop-database /usr/share/applications
和sudo update-mime-database /usr/share/mime
来更新各自的数据库,并查看反映在以下档案中的更改:
/usr/share/mime/globs
/usr/share/mime/globs2
当我看到从application/wps-office.docx
到application/vnd.openxmlformats-officedocument.wordprocessingml.document
的内容发生变化时,这一切似乎都起作用了。
但是命令gio info document.docx
继续返回standard::content-type: application/wps-office.docx
,其结果是,当将office文件上传到Google时,这些文件得到错误的mime类型,无法被识别为有效的Office文件。
是否有另一种方法影响mime类型映射,以便gio info document.docx
将开始返回正确的mime类型值(application/vnd.openxmlformats-officedocument.wordprocessingml.document
)?
我想继续安装WPS-Office .
发布于 2021-08-26 19:25:07
实际上,问题似乎在于WPS-Office正在添加一个~/.local/share/mime/packages/Override.xml
文件并运行update-mime-database
。
通过删除该文件并将common\do_not_detect_file_association_while_startup=true
添加到~/.config/Kingsoft/Office.conf
并随后运行sudo update-mime-database -V ~/.local/share/mime/
,您可以消除伪文件关联。
唯一奇怪的是命令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/
但是gio info document.docx
的输出现在是正确的:standard::content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
而上传到Google的内容被正确地识别为Word文件。
参考文献:
https://askubuntu.com/questions/1360278
复制相似问题