gnome-shell/src/hotplug-sniffer
Marco Trevisan (Treviño) ff73f76527 shell-mime-sniffer: Ignore invalid file content type
The shell mime sniffer goes through all the files in a directory,
however in case a file content type is not recognized, the GIO function
g_file_info_get_content_type() may return NULL, causing a crash when
looking up into the content type tables, as they are supposed to contain
strings only and they use `g_str_hash` has func, which doesn't support
NULL values.

So, in case we get an invalid content type, let's just ignore it,
without adding it to the cache as we do in the nautilus code that was
inspiring the sniffer.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2643


(cherry picked from commit 46547ae027)
2020-06-05 15:22:00 +00:00
..
hotplug-mimetypes.h *.[ch]: add emacs modeline to C files that were missing it 2011-10-11 08:05:17 -04:00
hotplug-sniffer.c cleanup: Use g_clear_handle_id() for g_source_remove() 2019-11-22 01:45:25 +01:00
meson.build build: Support the meson build system 2017-07-20 00:20:54 +02:00
org.gnome.Shell.HotplugSniffer.service.in sniffer: add a mimetype sniffer helper executable 2011-07-13 14:39:35 -04:00
shell-mime-sniffer.c shell-mime-sniffer: Ignore invalid file content type 2020-06-05 15:22:00 +00:00
shell-mime-sniffer.h hotplug-sniffer: Modernize GObject usage 2015-10-15 21:04:07 +02:00