diff options
Diffstat (limited to 'gio/glocalvfs.c')
-rw-r--r-- | gio/glocalvfs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gio/glocalvfs.c b/gio/glocalvfs.c index a830cc350..00fec8e2b 100644 --- a/gio/glocalvfs.c +++ b/gio/glocalvfs.c @@ -94,14 +94,24 @@ g_local_vfs_get_file_for_uri (GVfs *vfs, { char *path; GFile *file; - char *stripped_uri, *hash; - + char *stripped_uri, *hash, *question_mark; + + /* As per https://url.spec.whatwg.org/#file-state, file: URIs can contain + * query and fragment sections. We ignore them in order to get only the file + * path. Compliance to this part of the WhatWG spec doesn’t necessarily mean + * we comply with the entire spec. */ if (strchr (uri, '#') != NULL) { stripped_uri = g_strdup (uri); hash = strchr (stripped_uri, '#'); *hash = 0; } + else if (strchr (uri, '?') != NULL) + { + stripped_uri = g_strdup (uri); + question_mark = strchr (stripped_uri, '?'); + *question_mark = 0; + } else stripped_uri = (char *)uri; |