tymofij / fb2reader

FB2 Reader Firefox Addon
https://addons.mozilla.org/firefox/addon/fb2-reader/
21 stars 5 forks source link

Not opening local fb2 on Linux #8

Closed alexykot closed 4 years ago

alexykot commented 5 years ago

For some reason this plugin installed in Firefox on Arch Linux does not open the .fb2 files. I do have an unzipped local .fb2 file, but on attempting to open it in FF via Ctrl+O it only offers to save it or open with another application. Selecting "Firefox" that "another application" makes it go into infinite loop of opening new tabs with same save-or-open dialog, but no FB2 rendering actually happening.

monakhv commented 5 years ago

The same issue on Fedora 30.

tymofij commented 4 years ago

In Linux .fb2 files usually are associated with MIME type application/x-fictionbook+xml but Firefox refuses to do anything with those files. The extension never gets a chance. To make Firefox accept it, we must associate those files with text/xml MIME. (doc ExternalHelperAppService)

Solution:


Add

text/xml fb2

to your ~/.mime.types file.

Alternative solution:

Create ~/.local/share/mime/packages/fictionbook.xml with content

<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/xml">
    <glob pattern="*.fb2"/>
  </mime-type>
</mime-info>

and run update-mime-database ~/.local/share/mime

PS

Funnily, the issue arises exactly because Linux knows about .fb2 document type unlike MacOS/Windows which do not, and serve it as some unknown text/xml.