[gvfs/wip/oholy/google-shared-drives-support: 3/5] google: Provide volatile entries for old URIs




commit 8d9f81df5cad7a376f747ee26116240eafa3cd7e
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Jan 29 16:13:55 2021 +0100

    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 376771f5..cd41d61c 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)


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