Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not opening local fb2 on Linux #8

Closed
alexykot opened this issue Feb 5, 2019 · 2 comments
Closed

Not opening local fb2 on Linux #8

alexykot opened this issue Feb 5, 2019 · 2 comments

Comments

@alexykot
Copy link

alexykot commented Feb 5, 2019

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
Copy link

monakhv commented May 14, 2019

The same issue on Fedora 30.

@tymofij tymofij changed the title Not opening fb2 on Arch Linux Not opening local fb2 on Linux Jan 25, 2020
@tymofij
Copy link
Owner

tymofij commented Jan 25, 2020

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

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"/>
    <magic priority="99">
      <match type="string" value="&lt;FictionBook" offset="0:256"/>
    </magic>
  </mime-type>
</mime-info>

and run

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

after that check that the mime-type has been updated, run

xdg-mime query filetype some_book_file.fb2

it should output text/xml. Or see file properties in Nautilus, it should be "XML document".

Snap

This solution does not work for Snap Firefox packages.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants