Skip to content

Use local MIME database info

Python's mimetypes module is used for checking mimetypes in Catfish. It uses its own MIME database which differs from the local database. Checking xdg-mime query against mimetypes.guess_type often gives different results. And guess_type lacks many entries (when this happens it forces Catfish to check files it doesn't need to during fulltext search).

This checks for the /usr/share/mime/globs2 file generated by update-mime-database (from shared-mime-info) and allows Python's mimetypes module to use the local MIME results, matching xdg-mime (from xdg-utils).

This should keep the speed of guess_types but use a bigger and more accurate MIME list. It will give more accurate search results, help with file icon retrieval, and result in less disk reads (speeding up fulltext searches).

Merge request reports