0

Is there a way to map a filename and not a filetype on a specific mimetype?

Im using .config/mimeapps.list as default. I need this because Chromium does match the current mimetypes with the file extension and not with filenames and the file i want to autostart does not have a extension.

Im using Fedora26.

Nico
  • 323
  • 4
  • 14
  • Can you give your file an extension? Otherwise, look for a minimal http server where you can serve said file and control the content type header returned with your file. See python's simple http server: http://2ality.com/2014/06/simple-http-server.html There is example for adding mapping to extension to file. You can redefine the default case of no extension for your particular case. See also here for more details about serving requests: https://gist.github.com/UniIsland/3346170 – diginoise Jan 11 '18 at 09:38
  • See also chrome extension: https://chrome.google.com/webstore/detail/modify-content-type/jnfofbopfpaoeojgieggflbpcblhfhka or this anser: https://stackoverflow.com/questions/8323946/how-can-i-edit-chrome-mime-type-mappings – diginoise Jan 11 '18 at 09:42
  • @diginoise Unfortunately i cannot giv it an extension. And the Plugin is for Chrome and im not able to install it in Chromium-Browser – Nico Jan 11 '18 at 12:13
  • Can you run a small, http server? – diginoise Jan 11 '18 at 12:18
  • @diginoise I can but thats no valid longterm fix for me/us. Our ticket system generates this files in automated status update mails and i need to know if we have to change our whole system to "generate" a file with a extension or if there is an "easier" solution – Nico Jan 11 '18 at 13:01
  • Apparently Chrome will defer the mime type decision to `xdg`. See `xgd-mime` for details - perhaps you could add the mimetype of your file. PLease see: https://portland.freedesktop.org/doc/xdg-mime.html – diginoise Jan 11 '18 at 14:31
  • Yes i know how to use xdg-mime. When i execute `xdg-mime query filetype MYFILE` the output is `text/plain` and the association in my `~.config/mimeapps.list` looks like this `text/plain=ticketsystem.desktop` – Nico Jan 11 '18 at 16:08
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/163001/discussion-between-diginoise-and-nico). – diginoise Jan 11 '18 at 17:04

0 Answers0