From d54c36cc22c365bd21936365f7c9410899ad3ec1 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Fri, 25 Apr 2014 15:33:40 +0200 Subject: Ignore '/' at beginning of REST function When building the HTTP URL to access for a REST operation, RestProxyCall::prepare_message, a '/' at the end of the base URL is ignored, but a '/' at the beginning of the REST function is not. When interacting with the oVirt REST API, I often end up building calls with for example 'https://ovirt.example.com' as the base URI, and '/api/vms/' as the function, which then leads to an URI with 2 '/': 'https://ovirt.example.com//api/vms' https://bugzilla.gnome.org/show_bug.cgi?id=728952 --- rest/rest-proxy-call.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c index a264f2e..fbf4880 100644 --- a/rest/rest-proxy-call.c +++ b/rest/rest-proxy-call.c @@ -748,7 +748,8 @@ prepare_message (RestProxyCall *call, GError **error_out) /* FIXME: Perhaps excessive memory duplication */ if (priv->function) { - if (g_str_has_suffix (bound_url, "/")) + if (g_str_has_suffix (bound_url, "/") + || g_str_has_prefix (priv->function, "/")) { priv->url = g_strdup_printf ("%s%s", bound_url, priv->function); } else { -- cgit v1.2.1