summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackenddav.c
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2015-01-21 16:34:00 +0100
committerOndrej Holy <oholy@redhat.com>2015-01-22 08:32:00 +0100
commitf81ff2108ab3b6e370f20dcadd8708d23f499184 (patch)
tree25b59ce3ec6429f245b54cbd0d58eed397f2ee3a /daemon/gvfsbackenddav.c
parent2ddbf4d973effd7402f53a4f14798e5f945855df (diff)
downloadgvfs-f81ff2108ab3b6e370f20dcadd8708d23f499184.tar.gz
dav: don't unescape the uri twice
path_equal tries to unescape path before comparing. Unfortunately this function is used also for already unescaped paths. Therefore unescaping can fail. This commit reverts changes which was done in commit 50af53d and unescape just uris, which aren't unescaped yet. https://bugzilla.gnome.org/show_bug.cgi?id=743298
Diffstat (limited to 'daemon/gvfsbackenddav.c')
-rw-r--r--daemon/gvfsbackenddav.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index b0bc22db..8fc824d9 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -230,7 +230,6 @@ path_equal (const char *a, const char *b, gboolean relax)
{
gboolean res;
size_t a_len, b_len;
- char *ua, *ub;
if (relax == FALSE)
return str_equal (a, b, FALSE);
@@ -238,26 +237,20 @@ path_equal (const char *a, const char *b, gboolean relax)
if (a == NULL || b == NULL)
return a == b;
- ua = g_uri_unescape_string (a, "/");
- ub = g_uri_unescape_string (b, "/");
-
- a_len = strlen (ua);
- b_len = strlen (ub);
+ a_len = strlen (a);
+ b_len = strlen (b);
- while (a_len > 0 && ua[a_len - 1] == '/')
+ while (a_len > 0 && a[a_len - 1] == '/')
a_len--;
- while (b_len > 0 && ub[b_len - 1] == '/')
+ while (b_len > 0 && b[b_len - 1] == '/')
b_len--;
if (a_len == b_len)
- res = ! strncmp (ua, ub, a_len);
+ res = ! strncmp (a, b, a_len);
else
res = FALSE;
- g_free(ua);
- g_free(ub);
-
return res;
}
@@ -266,13 +259,20 @@ static gboolean
dav_uri_match (SoupURI *a, SoupURI *b, gboolean relax)
{
gboolean diff;
+ char *ua, *ub;
+
+ ua = g_uri_unescape_string (a->path, "/");
+ ub = g_uri_unescape_string (b->path, "/");
diff = a->scheme != b->scheme || a->port != b->port ||
! str_equal (a->host, b->host, TRUE) ||
- ! path_equal (a->path, b->path, relax) ||
+ ! path_equal (ua, ub, relax) ||
! str_equal (a->query, b->query, FALSE) ||
! str_equal (a->fragment, b->fragment, FALSE);
+ g_free (ua);
+ g_free (ub);
+
return !diff;
}