Web lists-archives.com

Using "user.mime_type" xattr for MIME guessing

Hi everyone,
I'm working on a FUSE file system which makes network requests whenever a file is read. So obviously, I would like to avoid excess read requests to files.

The current implementation [0] of gio's MIME guessing seems to check the file extension, and then immediately fall back on reading magic bytes when this is not possible (i.e. files with an ambiguous or no extension). In my situation, this can potentially lead to many network requests any time a user opens a directory in Nautilus or a file selection dialog.

According to the FreeDesktop specs [1], implementations may query the user.mime_type xattr for a given file's MIME. But the current version of glib seems not to make use of this.

Would there be any interest in a patch to add this functionality? If so, I would be happy to work on it.

Please let me know if there's anything I've missed/misunderstood.


[0]: https://github.com/GNOME/glib/blob/master/gio/xdgmime/xdgmime.c#L489
[1]: https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html#idm140625828614912

gtk-devel-list mailing list