diff options
| author | Milan Crha <mcrha@redhat.com> | 2023-03-29 10:45:16 +0200 |
|---|---|---|
| committer | Milan Crha <mcrha@redhat.com> | 2023-03-29 10:45:16 +0200 |
| commit | 976fee2ff85fc94c1bc5cc925ca7a2e2ad131297 (patch) | |
| tree | 181d1b0de8e0df172ded93f1a40a0e4d37a0ff53 /src/calendar | |
| parent | 27ce1d1ffdd35fda512f9d12351a90ae6e1ad989 (diff) | |
| download | evolution-data-server-976fee2ff85fc94c1bc5cc925ca7a2e2ad131297.tar.gz | |
I#462 - Fails to refresh backend with offline changes and broken local cache state
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/462
Diffstat (limited to 'src/calendar')
| -rw-r--r-- | src/calendar/libedata-cal/e-cal-meta-backend.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/calendar/libedata-cal/e-cal-meta-backend.c b/src/calendar/libedata-cal/e-cal-meta-backend.c index 7e8afd34c..c03e42339 100644 --- a/src/calendar/libedata-cal/e-cal-meta-backend.c +++ b/src/calendar/libedata-cal/e-cal-meta-backend.c @@ -110,6 +110,13 @@ static ICalTimezone * (* ecmb_timezone_cache_parent_get_timezone) (ETimezoneCach static GList * (* ecmb_timezone_cache_parent_list_timezones) (ETimezoneCache *cache); /* Forward Declarations */ +static gboolean ecmb_maybe_remove_from_cache (ECalMetaBackend *meta_backend, + ECalCache *cal_cache, + ECacheOfflineFlag offline_flag, + const gchar *uid, + guint32 custom_flags, + GCancellable *cancellable, + GError **error); static void e_cal_meta_backend_timezone_cache_init (ETimezoneCacheInterface *iface); G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ECalMetaBackend, e_cal_meta_backend, E_TYPE_CAL_BACKEND_SYNC, @@ -605,9 +612,24 @@ ecmb_upload_local_changes_sync (ECalMetaBackend *meta_backend, success = e_cal_cache_get_components_by_uid (cal_cache, change->uid, &instances, cancellable, error); if (success) { + GError *local_error = NULL; + success = ecmb_save_component_wrapper_sync (meta_backend, cal_cache, change->state == E_OFFLINE_STATE_LOCALLY_MODIFIED, - conflict_resolution, instances, extra, opflags, change->uid, NULL, NULL, NULL, cancellable, error); + conflict_resolution, instances, extra, opflags, change->uid, NULL, NULL, NULL, cancellable, &local_error); + + if (!success) { + if (g_error_matches (local_error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_OBJECT)) { + g_clear_error (&local_error); + success = TRUE; + + if (!ecmb_maybe_remove_from_cache (meta_backend, cal_cache, E_CACHE_IS_ONLINE, change->uid, 0, cancellable, NULL)) { + /* ignore any error here */ + } + } else if (local_error) { + g_propagate_error (error, local_error); + } + } } g_slist_free_full (instances, g_object_unref); @@ -618,7 +640,8 @@ ecmb_upload_local_changes_sync (ECalMetaBackend *meta_backend, change->uid, extra, change->object, opflags, cancellable, &local_error); if (!success) { - if (g_error_matches (local_error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND)) { + if (g_error_matches (local_error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND) || + g_error_matches (local_error, E_CAL_CLIENT_ERROR, E_CAL_CLIENT_ERROR_INVALID_OBJECT)) { g_clear_error (&local_error); success = TRUE; } else if (local_error) { |
