[libgdata] contacts: Always set an ETag in gdata_contacts_contact_set_photo()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata] contacts: Always set an ETag in gdata_contacts_contact_set_photo()
- Date: Sat, 20 Aug 2011 16:56:48 +0000 (UTC)
commit 68b5af5eabc0d3f81c9e7e69ce37bfba8c375c95
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Aug 20 17:42:35 2011 +0100
contacts: Always set an ETag in gdata_contacts_contact_set_photo()
If we don't have an ETag to hand, send â*â as the ETag. The server requires
that we send some kind of If-Match header.
gdata/services/contacts/gdata-contacts-contact.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index 78cb76c..19c9c02 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -3294,6 +3294,7 @@ gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataContactsServi
SoupMessage *message;
guint status;
gboolean deleting_photo = FALSE;
+ const gchar *etag;
g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (self), FALSE);
g_return_val_if_fail (GDATA_IS_CONTACTS_SERVICE (service), FALSE);
@@ -3307,9 +3308,16 @@ gdata_contacts_contact_set_photo (GDataContactsContact *self, GDataContactsServi
/* Get the photo URI */
_link = gdata_entry_look_up_link (GDATA_ENTRY (self), "http://schemas.google.com/contacts/2008/rel#photo");
g_assert (_link != NULL);
+
+ /* We always have to set an If-Match header. */
+ etag = self->priv->photo_etag;
+ if (etag == NULL || *etag == '\0') {
+ etag = "*";
+ }
+
message = _gdata_service_build_message (GDATA_SERVICE (service), gdata_contacts_service_get_primary_authorization_domain (),
(deleting_photo == TRUE) ? SOUP_METHOD_DELETE : SOUP_METHOD_PUT,
- gdata_link_get_uri (_link), self->priv->photo_etag, TRUE);
+ gdata_link_get_uri (_link), etag, TRUE);
/* Append the data */
if (deleting_photo == FALSE)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]