Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Created May 15, 2019 13:23
Show Gist options
  • Save Gro-Tsen/2961f34df4a29d143c7b3499fac7e130 to your computer and use it in GitHub Desktop.
Save Gro-Tsen/2961f34df4a29d143c7b3499fac7e130 to your computer and use it in GitHub Desktop.
Fix for DjVu files being detected as MIME type image/vnd.djvu instead of image/vnd.djvu+multipage
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<!-- Created on 2019-05-15 to fix a reappearance of this bug: -->
<!-- https://bugs.launchpad.net/ubuntu/+source/djvulibre/+bug/1778088 -->
<!-- (DjVu seen as image/vnd.djvu instead of image/vnd.djvu+multipage) -->
<!-- https://twitter.com/gro_tsen/status/1128645721614356480 -->
<!-- Run "update-mime-database ~/.local/share/mime" after creating this. -->
<!-- Use "xdg-mime query filetype some-file.djvu" to test. -->
<!-- - David A. Madore -->
<mime-type type="image/vnd.djvu+multipage">
<comment>DjVu image</comment>
<alias type="image/x-djvu"/>
<magic priority="99">
<match value="AT&amp;TFORM" type="string" offset="0">
<match value="DJVU" type="string" offset="12"/>
</match>
<match value="FORM" type="string" offset="0">
<match value="DJVU" type="string" offset="8"/>
</match>
</magic>
<glob pattern="*.djvu"/>
<glob pattern="*.djv"/>
</mime-type>
</mime-info>
@Gro-Tsen
Copy link
Author

The override.xml file in question should be placed in ~/.local/share/mime/packages/ and then run "update-mime-database ~/.local/share/mime" (to create or regenerate ~/.local/share/mime/mime.cache).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment