[evolution-data-server] Workaround issue with badRequest/invalid format for Google address book
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Workaround issue with badRequest/invalid format for Google address book
- Date: Wed, 26 Jul 2017 13:11:12 +0000 (UTC)
commit c2947758f2731ba00b112cd156c8642cc421a6fe
Author: Milan Crha <mcrha redhat com>
Date: Wed Jul 26 15:08:01 2017 +0200
Workaround issue with badRequest/invalid format for Google address book
This change is to workaround issue when Google server doesn't accept time format
being passed to it with libgdata in queries, which can result in badRequest/invalid
GData errors. Simply re-run the query without the time constraint.
.../backends/google/e-book-backend-google.c | 27 +++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
---
diff --git a/src/addressbook/backends/google/e-book-backend-google.c
b/src/addressbook/backends/google/e-book-backend-google.c
index 92e9ca6..645cbb1 100644
--- a/src/addressbook/backends/google/e-book-backend-google.c
+++ b/src/addressbook/backends/google/e-book-backend-google.c
@@ -319,6 +319,7 @@ ebb_google_get_groups_sync (EBookBackendGoogle *bbgoogle,
GDataQuery *query;
GDataFeed *feed;
gboolean success;
+ GError *local_error = NULL;
g_return_val_if_fail (E_IS_BOOK_BACKEND_GOOGLE (bbgoogle), FALSE);
g_return_val_if_fail (ebb_google_is_authorized (bbgoogle), FALSE);
@@ -337,7 +338,21 @@ ebb_google_get_groups_sync (EBookBackendGoogle *bbgoogle,
/* Run the query synchronously */
feed = gdata_contacts_service_query_groups (
GDATA_CONTACTS_SERVICE (bbgoogle->priv->service),
- query, cancellable, ebb_google_process_group, bbgoogle, error);
+ query, cancellable, ebb_google_process_group, bbgoogle, &local_error);
+
+ if (with_time_constraint && bbgoogle->priv->groups_last_update.tv_sec != 0 && (
+ g_error_matches (local_error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_BAD_QUERY_PARAMETER) ||
+ g_error_matches (local_error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR))) {
+ g_clear_error (&local_error);
+
+ gdata_query_set_updated_min (query, -1);
+
+ feed = gdata_contacts_service_query_groups (
+ GDATA_CONTACTS_SERVICE (bbgoogle->priv->service),
+ query, cancellable, ebb_google_process_group, bbgoogle, error);
+ } else if (local_error) {
+ g_propagate_error (error, local_error);
+ }
success = feed != NULL;
@@ -466,6 +481,16 @@ ebb_google_get_changes_sync (EBookMetaBackend *meta_backend,
feed = gdata_contacts_service_query_contacts (GDATA_CONTACTS_SERVICE (bbgoogle->priv->service),
GDATA_QUERY (contacts_query), cancellable, NULL, NULL, &local_error);
+ if (last_updated.tv_sec > 0 && !bbgoogle->priv->groups_changed && (
+ g_error_matches (local_error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_BAD_QUERY_PARAMETER) ||
+ g_error_matches (local_error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR))) {
+ g_clear_error (&local_error);
+
+ gdata_query_set_updated_min (GDATA_QUERY (contacts_query), -1);
+
+ feed = gdata_contacts_service_query_contacts (GDATA_CONTACTS_SERVICE
(bbgoogle->priv->service), GDATA_QUERY (contacts_query), cancellable, NULL, NULL, &local_error);
+ }
+
if (feed && !g_cancellable_is_cancelled (cancellable) && !local_error) {
GList *link;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]