mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
Merge branch '2932-check-etag-attributes' into 'main'
gfile: Check ETag attribute is present before trying to get it Closes #2932 See merge request GNOME/glib!3312
This commit is contained in:
commit
ab3076a242
@ -7783,7 +7783,7 @@ g_file_load_contents (GFile *file,
|
||||
NULL);
|
||||
if (info)
|
||||
{
|
||||
*etag_out = g_strdup (g_file_info_get_etag (info));
|
||||
*etag_out = g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ETAG_VALUE) ? g_strdup (g_file_info_get_etag (info)) : NULL;
|
||||
g_object_unref (info);
|
||||
}
|
||||
}
|
||||
@ -7857,7 +7857,7 @@ load_contents_fstat_callback (GObject *obj,
|
||||
stat_res, NULL);
|
||||
if (info)
|
||||
{
|
||||
data->etag = g_strdup (g_file_info_get_etag (info));
|
||||
data->etag = g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_ETAG_VALUE) ? g_strdup (g_file_info_get_etag (info)) : NULL;
|
||||
g_object_unref (info);
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,9 @@ calc_event_type (GFileInfo *last,
|
||||
if (last != NULL && new == NULL)
|
||||
return G_FILE_MONITOR_EVENT_DELETED;
|
||||
|
||||
if (g_strcmp0 (g_file_info_get_etag (last), g_file_info_get_etag (new)))
|
||||
if (g_file_info_has_attribute (last, G_FILE_ATTRIBUTE_ETAG_VALUE) &&
|
||||
g_file_info_has_attribute (new, G_FILE_ATTRIBUTE_ETAG_VALUE) &&
|
||||
g_strcmp0 (g_file_info_get_etag (last), g_file_info_get_etag (new)) != 0)
|
||||
return G_FILE_MONITOR_EVENT_CHANGED;
|
||||
|
||||
if (g_file_info_get_size (last) != g_file_info_get_size (new))
|
||||
|
Loading…
Reference in New Issue
Block a user