From 1bcb0b6196a624e0f99dc50d169d314f57abb286 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 31 Jan 2023 12:21:02 +0100 Subject: goaowncloudprovider: Encode user name in calendar/contacts/files URI The GUri is constructed with a flag claiming its parts are already encoded, but when writing verbatim identity as a user name part, it can break parsing the GUri back from a string when the identity contains special characters like an `@`. Writing encoded identity to such GUri fixes the problem. Closes https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/243 --- src/goabackend/goaowncloudprovider.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/goabackend/goaowncloudprovider.c b/src/goabackend/goaowncloudprovider.c index e36c702..977eb4b 100644 --- a/src/goabackend/goaowncloudprovider.c +++ b/src/goabackend/goaowncloudprovider.c @@ -175,10 +175,12 @@ build_object (GoaProvider *provider, if (uri != NULL) { GUri *tmp_uri; + gchar *encoded_identity; + encoded_identity = g_uri_escape_string (identity, NULL, FALSE); tmp_uri = g_uri_build_with_user (g_uri_get_flags (uri), g_uri_get_scheme (uri), - identity, + encoded_identity, g_uri_get_password (uri), g_uri_get_auth_params (uri), g_uri_get_host (uri), @@ -186,6 +188,7 @@ build_object (GoaProvider *provider, g_uri_get_path (uri), g_uri_get_query (uri), g_uri_get_fragment (uri)); + g_free (encoded_identity); g_uri_unref (uri); uri = tmp_uri; } -- cgit v1.2.1