diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2014-09-02 18:07:03 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2014-09-03 12:17:28 +0200 |
commit | e36c4e0b9931167e3fb41abb994e19d18ed01ad7 (patch) | |
tree | 1246d5329372541f4fdafcdf726689e474128019 | |
parent | 3fbb49ab9ac021362ebe3474d12584f1b75e79ed (diff) |
flickr: Fix function setting regression
Since commit c66b6d, RestProxyCall::url is regenerated after calling the
RestProxyCall::prepare virtual method. This breaks the flickr code as
it needs to reset RestProxyCall::url in order to remove the function
from it.
It used to do that by directly accessing RestProxyCall private
data. Since c66b6d, this can be solved using only public methods as
if the function is reset on the RestProxyCall in ::prepare, ::url will
be regenerated to reflect that after ::prepare and ::serialize_params
have been called.
https://bugzilla.gnome.org/show_bug.cgi?id=708359
(cherry picked from commit fe1a864e4a6739ad07d890cd47f8cf180a3d1cdf)
-rw-r--r-- | rest-extras/flickr-proxy-call.c | 12 | ||||
-rw-r--r-- | rest-extras/flickr-proxy.c | 4 |
2 files changed, 10 insertions, 6 deletions
diff --git a/rest-extras/flickr-proxy-call.c b/rest-extras/flickr-proxy-call.c index a9bc6f7..d03f919 100644 --- a/rest-extras/flickr-proxy-call.c +++ b/rest-extras/flickr-proxy-call.c @@ -70,13 +70,17 @@ _prepare (RestProxyCall *call, GError **error) priv = FLICKR_PROXY_GET_PRIVATE (proxy); call_priv = call->priv; - /* We need to reset the URL because Flickr puts the function in the parameters */ if (GET_PRIVATE (call)->upload) { - call_priv->url = g_strdup ("http://api.flickr.com/services/upload/"); + rest_proxy_bind (REST_PROXY(proxy), "upload"); + rest_proxy_call_set_function (call, NULL); } else { - call_priv->url = g_strdup ("http://api.flickr.com/services/rest/"); - rest_proxy_call_add_param (call, "method", call_priv->function); + rest_proxy_bind (REST_PROXY(proxy), "rest"); + rest_proxy_call_add_param (call, "method", + rest_proxy_call_get_function (call)); + /* We need to reset the function because Flickr puts the function in the + * parameters, not in the base URL */ + rest_proxy_call_set_function (call, NULL); } rest_proxy_call_add_param (call, "api_key", priv->api_key); diff --git a/rest-extras/flickr-proxy.c b/rest-extras/flickr-proxy.c index 5b7d960..48f1c86 100644 --- a/rest-extras/flickr-proxy.c +++ b/rest-extras/flickr-proxy.c @@ -188,8 +188,8 @@ flickr_proxy_new_with_token (const char *api_key, "api-key", api_key, "shared-secret", shared_secret, "token", token, - "url-format", "http://api.flickr.com/services/rest/", - "binding-required", FALSE, + "url-format", "http://api.flickr.com/services/%s/", + "binding-required", TRUE, NULL); } |