[evolution-data-server/wip/mcrha/soup3] CalDAV/CardDAV: Correct/synchronize URI construction for PUT
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/mcrha/soup3] CalDAV/CardDAV: Correct/synchronize URI construction for PUT
- Date: Wed, 1 Jun 2022 11:49:58 +0000 (UTC)
commit 59f5d86da8fb959aa8624ef1a2d7e603d38f8718
Author: Milan Crha <mcrha redhat com>
Date: Wed Jun 1 13:49:03 2022 +0200
CalDAV/CardDAV: Correct/synchronize URI construction for PUT
.../backends/carddav/e-book-backend-carddav.c | 9 ++++----
.../backends/caldav/e-cal-backend-caldav.c | 25 +++++++++++-----------
2 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/src/addressbook/backends/carddav/e-book-backend-carddav.c
b/src/addressbook/backends/carddav/e-book-backend-carddav.c
index d9c5253ad..19aa9802f 100644
--- a/src/addressbook/backends/carddav/e-book-backend-carddav.c
+++ b/src/addressbook/backends/carddav/e-book-backend-carddav.c
@@ -1007,21 +1007,22 @@ ebb_carddav_uid_to_uri (EBookBackendCardDAV *bbdav,
if (extension) {
tmp = g_strconcat (uid, extension, NULL);
- filename = g_filename_to_uri (tmp, NULL, NULL);
+ filename = g_uri_escape_string (tmp, NULL, FALSE);
g_free (tmp);
} else {
- filename = g_filename_to_uri (uid, NULL, NULL);
+ filename = g_uri_escape_string (uid, NULL, FALSE);
}
- if (*g_uri_get_path (guri)) {
+ if (g_uri_get_path (guri) && *g_uri_get_path (guri)) {
const gchar *slash = strrchr (g_uri_get_path (guri), '/');
if (slash && !slash[1])
tmp = g_strconcat (g_uri_get_path (guri), filename, NULL);
else
tmp = g_strconcat (g_uri_get_path (guri), "/", filename, NULL);
- } else
+ } else {
tmp = g_strconcat ("/", filename, NULL);
+ }
e_util_change_uri_component (&guri, SOUP_URI_PATH, tmp);
g_free (tmp);
diff --git a/src/calendar/backends/caldav/e-cal-backend-caldav.c
b/src/calendar/backends/caldav/e-cal-backend-caldav.c
index cd3969d67..fc107cca7 100644
--- a/src/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/src/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -1165,15 +1165,15 @@ ecb_caldav_uid_to_uri (ECalBackendCalDAV *cbdav,
const gchar *extension)
{
ESourceWebdav *webdav_extension;
- GUri *parsed_uri;
+ GUri *guri;
gchar *uri, *tmp, *filename, *uid_hash = NULL;
g_return_val_if_fail (E_IS_CAL_BACKEND_CALDAV (cbdav), NULL);
g_return_val_if_fail (uid != NULL, NULL);
webdav_extension = e_source_get_extension (e_backend_get_source (E_BACKEND (cbdav)),
E_SOURCE_EXTENSION_WEBDAV_BACKEND);
- parsed_uri = e_source_webdav_dup_uri (webdav_extension);
- g_return_val_if_fail (parsed_uri != NULL, NULL);
+ guri = e_source_webdav_dup_uri (webdav_extension);
+ g_return_val_if_fail (guri != NULL, NULL);
/* UIDs with forward slashes can cause trouble, because the destination server can
consider them as a path delimiter. Double-encode the URL doesn't always work,
@@ -1193,22 +1193,23 @@ ecb_caldav_uid_to_uri (ECalBackendCalDAV *cbdav,
filename = g_uri_escape_string (uid, NULL, FALSE);
}
- if (g_uri_get_path (parsed_uri)) {
- gchar *slash = strrchr (g_uri_get_path (parsed_uri), '/');
+ if (g_uri_get_path (guri) && *g_uri_get_path (guri)) {
+ const gchar *slash = strrchr (g_uri_get_path (guri), '/');
if (slash && !slash[1])
- *slash = '\0';
+ tmp = g_strconcat (g_uri_get_path (guri), filename, NULL);
+ else
+ tmp = g_strconcat (g_uri_get_path (guri), "/", filename, NULL);
+ } else {
+ tmp = g_strconcat ("/", filename, NULL);
}
- tmp = g_strconcat (g_uri_get_path (parsed_uri) && *g_uri_get_path (parsed_uri) ? g_uri_get_path
(parsed_uri) : "", "/", filename, NULL);
-
- e_util_change_uri_component (&parsed_uri, SOUP_URI_PATH, tmp);
-
+ e_util_change_uri_component (&guri, SOUP_URI_PATH, tmp);
g_free (tmp);
- uri = g_uri_to_string_partial (parsed_uri, G_URI_HIDE_PASSWORD | G_URI_HIDE_USERINFO);
+ uri = g_uri_to_string_partial (guri, G_URI_HIDE_USERINFO | G_URI_HIDE_PASSWORD);
- g_uri_unref (parsed_uri);
+ g_uri_unref (guri);
g_free (filename);
g_free (uid_hash);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]