[evolution-data-server] I#177 - DAV: Ignore 404 responses on content refresh
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] I#177 - DAV: Ignore 404 responses on content refresh
- Date: Thu, 5 Dec 2019 12:36:35 +0000 (UTC)
commit d1d09ef2a888b4f61e1903bcf1ba22cfbb8dda63
Author: Milan Crha <mcrha redhat com>
Date: Thu Dec 5 13:37:34 2019 +0100
I#177 - DAV: Ignore 404 responses on content refresh
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/177
.../backends/carddav/e-book-backend-carddav.c | 29 ++++++++++++++++++++++
.../libedata-book/e-book-meta-backend.c | 14 ++---------
.../backends/caldav/e-cal-backend-caldav.c | 29 ++++++++++++++++++++++
src/calendar/libedata-cal/e-cal-meta-backend.c | 14 ++---------
4 files changed, 62 insertions(+), 24 deletions(-)
---
diff --git a/src/addressbook/backends/carddav/e-book-backend-carddav.c
b/src/addressbook/backends/carddav/e-book-backend-carddav.c
index c1abdca25..d1577c17f 100644
--- a/src/addressbook/backends/carddav/e-book-backend-carddav.c
+++ b/src/addressbook/backends/carddav/e-book-backend-carddav.c
@@ -435,6 +435,29 @@ ebb_carddav_multiget_response_cb (EWebDAVSession *webdav,
g_free (address_data);
g_free (etag);
+ } else if (status_code == SOUP_STATUS_NOT_FOUND) {
+ GSList *link;
+
+ g_return_val_if_fail (href != NULL, FALSE);
+
+ for (link = *from_link; link; link = g_slist_next (link)) {
+ EBookMetaBackendInfo *nfo = link->data;
+
+ if (!nfo)
+ continue;
+
+ if (g_strcmp0 (nfo->extra, href) == 0) {
+ /* If the server returns data in the same order as it had been requested,
+ then this speeds up lookup for the matching object. */
+ if (link == *from_link)
+ *from_link = g_slist_next (*from_link);
+
+ e_book_meta_backend_info_free (nfo);
+ link->data = NULL;
+
+ break;
+ }
+ }
}
return TRUE;
@@ -1068,6 +1091,12 @@ ebb_carddav_load_contact_sync (EBookMetaBackend *meta_backend,
if (local_error) {
ebb_carddav_check_credentials_error (bbdav, webdav, local_error);
+
+ if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
+ local_error->domain = E_BOOK_CLIENT_ERROR;
+ local_error->code = E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND;
+ }
+
g_propagate_error (error, local_error);
}
diff --git a/src/addressbook/libedata-book/e-book-meta-backend.c
b/src/addressbook/libedata-book/e-book-meta-backend.c
index 7e9aa26b1..047a905a5 100644
--- a/src/addressbook/libedata-book/e-book-meta-backend.c
+++ b/src/addressbook/libedata-book/e-book-meta-backend.c
@@ -3542,12 +3542,7 @@ e_book_meta_backend_process_changes_sync (EBookMetaBackend *meta_backend,
EBookMetaBackendInfo *nfo = link->data;
GError *local_error = NULL;
- if (!nfo || !nfo->uid) {
- g_warn_if_reached ();
- continue;
- }
-
- if (!*nfo->uid ||
+ if (!nfo || !nfo->uid || !*nfo->uid ||
g_hash_table_contains (covered_uids, nfo->uid))
continue;
@@ -3577,12 +3572,7 @@ e_book_meta_backend_process_changes_sync (EBookMetaBackend *meta_backend,
EBookMetaBackendInfo *nfo = link->data;
GError *local_error = NULL;
- if (!nfo || !nfo->uid) {
- g_warn_if_reached ();
- continue;
- }
-
- if (!*nfo->uid)
+ if (!nfo || !nfo->uid || !*nfo->uid)
continue;
success = ebmb_load_contact_wrapper_sync (meta_backend, book_cache, nfo->uid, nfo->object,
nfo->extra, NULL, cancellable, &local_error);
diff --git a/src/calendar/backends/caldav/e-cal-backend-caldav.c
b/src/calendar/backends/caldav/e-cal-backend-caldav.c
index e70838c5e..f85ae4e10 100644
--- a/src/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/src/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -456,6 +456,29 @@ ecb_caldav_multiget_response_cb (EWebDAVSession *webdav,
g_free (calendar_data);
g_free (etag);
+ } else if (status_code == SOUP_STATUS_NOT_FOUND) {
+ GSList *link;
+
+ g_return_val_if_fail (href != NULL, FALSE);
+
+ for (link = *from_link; link; link = g_slist_next (link)) {
+ ECalMetaBackendInfo *nfo = link->data;
+
+ if (!nfo)
+ continue;
+
+ if (g_strcmp0 (nfo->extra, href) == 0) {
+ /* If the server returns data in the same order as it had been requested,
+ then this speeds up lookup for the matching object. */
+ if (link == *from_link)
+ *from_link = g_slist_next (*from_link);
+
+ e_cal_meta_backend_info_free (nfo);
+ link->data = NULL;
+
+ break;
+ }
+ }
}
return TRUE;
@@ -1285,6 +1308,12 @@ ecb_caldav_load_component_sync (ECalMetaBackend *meta_backend,
if (local_error) {
ecb_caldav_check_credentials_error (cbdav, webdav, local_error);
+
+ if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
+ local_error->domain = E_CAL_CLIENT_ERROR;
+ local_error->code = E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND;
+ }
+
g_propagate_error (error, local_error);
}
diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c
index 19ce7d0f4..977eb5113 100644
--- a/src/calendar/libedata-cal/e-cal-meta-backend.c
+++ b/src/calendar/libedata-cal/e-cal-meta-backend.c
@@ -4678,12 +4678,7 @@ e_cal_meta_backend_process_changes_sync (ECalMetaBackend *meta_backend,
ECalMetaBackendInfo *nfo = link->data;
GError *local_error = NULL;
- if (!nfo || !nfo->uid) {
- g_warn_if_reached ();
- continue;
- }
-
- if (!*nfo->uid ||
+ if (!nfo || !nfo->uid || !*nfo->uid ||
g_hash_table_contains (covered_uids, nfo->uid))
continue;
@@ -4713,12 +4708,7 @@ e_cal_meta_backend_process_changes_sync (ECalMetaBackend *meta_backend,
ECalMetaBackendInfo *nfo = link->data;
GError *local_error = NULL;
- if (!nfo || !nfo->uid) {
- g_warn_if_reached ();
- continue;
- }
-
- if (!*nfo->uid)
+ if (!nfo || !nfo->uid || !*nfo->uid)
continue;
success = ecmb_load_component_wrapper_sync (meta_backend, cal_cache, nfo->uid, nfo->object,
nfo->extra, NULL, cancellable, &local_error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]