mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-05 00:43:40 +02:00
glocalfileinfo: Ensure we always sniff some data to get the content type
In case the XDG database is not initialized yet we may try to sniff a 0-length data, making our content-type routines to mark non-empty files as `application/x-zerosize`. This is wrong, so in case the sniff size is not set, let's just try to read the default value. To avoid false-application/x-zerosize results (that are not something we want as per legacy assumptions). See: https://bugzilla.gnome.org/show_bug.cgi?id=755795 Fixes: https://gitlab.gnome.org/GNOME/glib/-/issues/2742
This commit is contained in:
@@ -1388,7 +1388,7 @@ get_content_type (const char *basename,
|
||||
int fd, errsv;
|
||||
|
||||
sniff_length = _g_unix_content_type_get_sniff_len ();
|
||||
if (sniff_length > 4096)
|
||||
if (sniff_length == 0 || sniff_length > 4096)
|
||||
sniff_length = 4096;
|
||||
|
||||
#ifdef O_NOATIME
|
||||
|
Reference in New Issue
Block a user