[gvfs/gnome-3-12] dav: don't unescape the uri twice
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-12] dav: don't unescape the uri twice
- Date: Thu, 22 Jan 2015 07:37:05 +0000 (UTC)
commit 0abdd97989d5274d84017490aff3bf07a71fd672
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 75538f1..cb03c08 100644
--- a/daemon/gvfsbackenddav.c
+++ b/daemon/gvfsbackenddav.c
@@ -229,7 +229,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);
@@ -237,26 +236,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;
}
@@ -265,13 +258,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]