[evolution-data-server] I#44 - [CalDAV/CardDAV] Ignore Not Found error on resource delete



commit 4a9f5b7890193a41b5827d4ff847e6419eb1fac9
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 11 11:08:41 2018 +0200

    I#44 - [CalDAV/CardDAV] Ignore Not Found error on resource delete
    
    Closes https://gitlab.gnome.org/GNOME/evolution-data-server/issues/44

 src/addressbook/backends/carddav/e-book-backend-carddav.c | 7 +++++++
 src/calendar/backends/caldav/e-cal-backend-caldav.c       | 7 +++++++
 2 files changed, 14 insertions(+)
---
diff --git a/src/addressbook/backends/carddav/e-book-backend-carddav.c 
b/src/addressbook/backends/carddav/e-book-backend-carddav.c
index 29c27927e..b2afae39a 100644
--- a/src/addressbook/backends/carddav/e-book-backend-carddav.c
+++ b/src/addressbook/backends/carddav/e-book-backend-carddav.c
@@ -1230,6 +1230,13 @@ ebb_carddav_remove_contact_sync (EBookMetaBackend *meta_backend,
        g_object_unref (contact);
        g_free (etag);
 
+       /* Ignore not found errors, this was a delete and the resource is gone.
+          It can be that it had been deleted on the server by other application. */
+       if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
+               g_clear_error (&local_error);
+               success = TRUE;
+       }
+
        if (local_error) {
                ebb_carddav_check_credentials_error (bbdav, webdav, local_error);
                g_propagate_error (error, 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 c6b98f7d5..c3b7683c5 100644
--- a/src/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/src/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -1404,6 +1404,13 @@ ecb_caldav_remove_component_sync (ECalMetaBackend *meta_backend,
        icalcomponent_free (icalcomp);
        g_free (etag);
 
+       /* Ignore not found errors, this was a delete and the resource is gone.
+          It can be that it had been deleted on the server by other application. */
+       if (g_error_matches (local_error, SOUP_HTTP_ERROR, SOUP_STATUS_NOT_FOUND)) {
+               g_clear_error (&local_error);
+               success = TRUE;
+       }
+
        if (local_error) {
                ecb_caldav_check_credentials_error (cbdav, webdav, local_error);
                g_propagate_error (error, local_error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]