mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 00:16:15 +01:00
Merge branch '1819-file-for-uri-null' into 'master'
Resolve "Invalid characters in Open Location dialog crashes GIMP" Closes #1819 See merge request GNOME/glib!966
This commit is contained in:
commit
1c41e348ae
10
gio/gvfs.c
10
gio/gvfs.c
@ -236,7 +236,7 @@ g_vfs_get_file_for_uri (GVfs *vfs,
|
||||
const char *uri)
|
||||
{
|
||||
GVfsClass *class;
|
||||
GFile *ret;
|
||||
GFile *ret = NULL;
|
||||
|
||||
g_return_val_if_fail (G_IS_VFS (vfs), NULL);
|
||||
g_return_val_if_fail (uri != NULL, NULL);
|
||||
@ -244,10 +244,12 @@ g_vfs_get_file_for_uri (GVfs *vfs,
|
||||
class = G_VFS_GET_CLASS (vfs);
|
||||
|
||||
ret = get_file_for_uri_internal (vfs, uri);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (!ret)
|
||||
ret = (* class->get_file_for_uri) (vfs, uri);
|
||||
|
||||
return (* class->get_file_for_uri) (vfs, uri);
|
||||
g_assert (ret != NULL);
|
||||
|
||||
return g_steal_pointer (&ret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ g_winhttp_file_init (GWinHttpFile *winhttp)
|
||||
* @vfs: GWinHttpVfs to use
|
||||
* @uri: URI of the GWinHttpFile to create.
|
||||
*
|
||||
* Returns: new winhttp #GFile.
|
||||
* Returns: (nullable): new winhttp #GFile, or %NULL if there was an error constructing it.
|
||||
*/
|
||||
GFile *
|
||||
_g_winhttp_file_new (GWinHttpVfs *vfs,
|
||||
|
@ -165,15 +165,25 @@ g_winhttp_vfs_get_file_for_uri (GVfs *vfs,
|
||||
{
|
||||
GWinHttpVfs *winhttp_vfs = G_WINHTTP_VFS (vfs);
|
||||
int i;
|
||||
GFile *ret = NULL;
|
||||
|
||||
/* If it matches one of "our" schemes, handle it */
|
||||
for (i = 0; i < G_N_ELEMENTS (winhttp_uri_schemes); i++)
|
||||
if (g_ascii_strncasecmp (uri, winhttp_uri_schemes[i], strlen (winhttp_uri_schemes[i])) == 0 &&
|
||||
uri[strlen (winhttp_uri_schemes[i])] == ':')
|
||||
return _g_winhttp_file_new (winhttp_vfs, uri);
|
||||
{
|
||||
if (g_ascii_strncasecmp (uri, winhttp_uri_schemes[i], strlen (winhttp_uri_schemes[i])) == 0 &&
|
||||
uri[strlen (winhttp_uri_schemes[i])] == ':')
|
||||
{
|
||||
ret = _g_winhttp_file_new (winhttp_vfs, uri);
|
||||
}
|
||||
}
|
||||
|
||||
/* For other URIs fallback to the wrapped GVfs */
|
||||
return g_vfs_get_file_for_uri (winhttp_vfs->wrapped_vfs, uri);
|
||||
if (ret == NULL)
|
||||
ret = g_vfs_get_file_for_uri (winhttp_vfs->wrapped_vfs, uri);
|
||||
|
||||
g_assert (ret != NULL);
|
||||
|
||||
return g_steal_pointer (&ret);
|
||||
}
|
||||
|
||||
static const gchar * const *
|
||||
|
Loading…
Reference in New Issue
Block a user