3

I'm using Firefox 41.0.1 on Fedora 22.

I noticed this behaviour when I was trying to open a PNG image link on a GitLab site. The server replies with "Content-Disposition:"inline; filename="logo.png" and Content-Type:"application/octet-stream".

I want it to either display the image on the browser, or offer me to open it on the system default image viewer. I know it is possible, at least in Windows. See the GIF below kindly provided by @JourneymanGeek:

enter image description here

I made some tests using this tool and, apparently, when I click a link and the response headers contains the application/octet-stream mime type, Firefox offers me to open the file using gedit, stating it's the default application.

enter image description here

  • If I download the file (in this case, a PNG image) and double-click on it, it opens on Eye of Gnome.
  • xdg-open also opens it in Eye of Gnome.
  • application/octet-stream isn't present on /usr/share/applications/defaults.list
  • $ grep "gedit" /usr/share/applications/defaults.list returns only text/plain=org.gnome.gedit.desktop
  • I have removed the ~/.mozilla/firefox/<profile>/mimeTypes.rdf file and the issue persits.
  • I have also removed the ~/.local/share/applications/mimeapps.list file and the issue still persists.
  • I have restarted Firefox and logged out of my Gnome profile as well.

Here's the Firefox file association screen:

enter image description here

So, again, my question is: is it possible to have Firefox either display the file on the browser (if it is a file it's able of rendering), or offering the correct application able of rendering it (if there's one on the system)?

Or does the server declaring the incorrect mime-type renders it all impossible?

Also, why is it thinking gedit is the default octet-stream handler? Is this correct?

4

I have also removed the ~/.local/share/applications/mimeapps.list file and the issue still persists.

There is likely another mimeapps.list elsewhere on the system. You can go through the list here, or search through your system with one of the following commands:

locate mimeapps.list

or

find / -name 'mimeapps.list'

Check for any application/octet-stream entries in those, and either comment them out or remove them.

  • 2
    For me it was ~/.config/mimeapps.list that contained application/octet-stream=org.gnome.gedit.desktop. – That Brazilian Guy Oct 20 '15 at 14:50
  • (This answer was posted following some chat discussion.) – Bob Oct 20 '15 at 14:51
  • Thanks man. Removing the line fixed this immediately. Was struggling with that for months now. – nerdoc Apr 13 '16 at 13:49
1

Well, seems that Firefox will not fix this issue but I fixed it in my way removing the application/octet-stream=org.gnome.gedit.desktop from my ~/.config/mimeapps.list and using the add-on OpenDownload² to provide me the Run option.

If the extension of the file being downloaded is correctly configured in the mimeapps.list, firefox will open (run) it like a charm.

  • By the way I'm using Firefox 41.0.2 on Arch Linux. – Geyslan G. Bem Nov 1 '15 at 19:56
0

@Bob answered part 2 of the question: how to control which app opens the file.

The answer to part 1 is: Firefox downloads all files of type application/octet-stream by design. According to the HTTP standard, a compliant browser MUST NOT second-guess the server if a content-type is specified. Since octet-stream files contain arbitrary data, the browser should download them.

Most browsers ignore the standard in favor of user friendliness. Firefox does not. As stated in @Geyslan's answer, you would need to use a 3rd party extension to circumvent this design choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.