From 0be223b00d7229ab37c9e250f3969656d38d3457 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Sat, 2 Aug 2008 20:23:53 +0000 Subject: =?UTF-8?q?Bug=20528891=20=E2=80=93=20Handle=20URI=20schemes=20cas?= =?UTF-8?q?e=20insensitive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=1853 --- ChangeLog | 6 ++++++ client/gdaemonvfs.c | 24 ++++++++++++++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43f10bb1..daa29bf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-02 Christian Kellner + + * 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 * daemon/gvfsbackendtrash.c: Don't include internal mounts 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); -- cgit v1.2.1