[gvfs] dav: don't unescape the uri twice
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] dav: don't unescape the uri twice
- Date: Thu, 22 Jan 2015 07:34:13 +0000 (UTC)
commit f81ff2108ab3b6e370f20dcadd8708d23f499184
Author: Ondrej Holy <oholy redhat com>
Date: Wed Jan 21 16:34:00 2015 +0100
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
daemon/gvfsbackenddav.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/daemon/gvfsbackenddav.c b/daemon/gvfsbackenddav.c
index b0bc22d..8fc824d 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]