summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kellner <gicmo@src.gnome.org>2008-08-02 20:23:53 +0000
committerChristian Kellner <gicmo@src.gnome.org>2008-08-02 20:23:53 +0000
commit0be223b00d7229ab37c9e250f3969656d38d3457 (patch)
tree8abb0fb978bfa5a1204917f358813b9fb7621f98
parenta9ff9ffefc1937e508f03410fde90cea564c43b8 (diff)
downloadgvfs-0be223b00d7229ab37c9e250f3969656d38d3457.tar.gz
Bug 528891 – Handle URI schemes case insensitive
svn path=/trunk/; revision=1853
-rw-r--r--ChangeLog6
-rw-r--r--client/gdaemonvfs.c24
2 files changed, 26 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 43f10bb1..daa29bf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-08-02 Christian Kellner <gicmo@gnome.org>
+ * client/gdaemonvfs.c:
+ Make sure we handle URI schemes case insensitive, so that File://
+ and other versions also work. Bug #528891
+
+2008-08-02 Christian Kellner <gicmo@gnome.org>
+
* daemon/gvfsbackendtrash.c: Don't include internal mounts
while building up the list of trash directories. Bug #525779
Patcg from A. Walton <awalton@svn.gnome.org>
diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c
index 17dca3fe..55d56632 100644
--- a/client/gdaemonvfs.c
+++ b/client/gdaemonvfs.c
@@ -156,6 +156,19 @@ get_mountable_info_for_type (GDaemonVfs *vfs,
return NULL;
}
+static void
+str_tolower_inplace (char *str)
+{
+ char *p = str;
+
+ while (*p != 0)
+ {
+ *p = g_ascii_tolower (*p);
+ p++;
+ }
+
+}
+
static gboolean
get_mountspec_from_uri (GDaemonVfs *vfs,
const char *uri,
@@ -171,6 +184,10 @@ get_mountspec_from_uri (GDaemonVfs *vfs,
scheme = g_uri_parse_scheme (uri);
if (scheme == NULL)
return FALSE;
+
+ /* convert the scheme to lower case since g_uri_prase_scheme
+ * doesn't do that and we compare with g_str_equal */
+ str_tolower_inplace (scheme);
spec = NULL;
path = NULL;
@@ -193,7 +210,7 @@ get_mountspec_from_uri (GDaemonVfs *vfs,
{
GDecodedUri *decoded;
MountableInfo *mountable;
- char *type, *p;
+ char *type;
int l;
decoded = g_vfs_decode_uri (uri);
@@ -213,8 +230,7 @@ get_mountspec_from_uri (GDaemonVfs *vfs,
if (mountable && mountable->host_is_inet)
{
/* Convert hostname to lower case */
- for (p = decoded->host; *p != 0; p++)
- *p = g_ascii_tolower (*p);
+ str_tolower_inplace (decoded->host);
/* Remove brackets aroung ipv6 addresses */
l = strlen (decoded->host);
@@ -356,7 +372,7 @@ g_daemon_vfs_get_file_for_uri (GVfs *vfs,
daemon_vfs = G_DAEMON_VFS (vfs);
- if (g_str_has_prefix (uri, "file:"))
+ if (g_ascii_strncasecmp (uri, "file:", 5) == 0)
{
path = g_filename_from_uri (uri, NULL, NULL);