From 27b932ec3bf0d40ca33924ed9e8eaf61a353292c Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Fri, 29 Jan 2021 16:13:55 +0100 Subject: google: Provide volatile entries for old URIs The My Drive folder was added to the root, which changed URIs from /file-id to /root-id/file-id. Let's provide volatile entries in the old locations to not break user bookmarks... --- daemon/gvfsbackendgoogle.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c index 27f670ac..684a2e8a 100644 --- a/daemon/gvfsbackendgoogle.c +++ b/daemon/gvfsbackendgoogle.c @@ -1088,8 +1088,26 @@ resolve (GVfsBackendGoogle *self, ret_val = resolve_child (self, parent, basename, cancellable, &local_error); if (ret_val == NULL) { - g_propagate_error (error, local_error); - goto out; + /* This fallback provides volatile entries for URIs which was used + * before My Drive folder was added in the root. */ + if (parent == self->root) + { + g_clear_error (&local_error); + ret_val = resolve_child (self, self->home, basename, cancellable, &local_error); + if (ret_val != NULL && out_path != NULL) + { + gchar *tmp; + tmp = g_build_path ("/", *out_path, gdata_entry_get_id (self->home), NULL); + g_free (*out_path); + *out_path = tmp; + } + } + + if (ret_val == NULL) + { + g_propagate_error (error, local_error); + goto out; + } } if (out_path != NULL) -- cgit v1.2.1