diff options
author | Ondrej Holy <oholy@redhat.com> | 2015-10-19 13:48:46 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2015-10-23 09:07:38 +0200 |
commit | d236257299344207736086400960b0add2c1200b (patch) | |
tree | b41bd6c13abc54445b82b418d48a8120252f55ef /daemon/gvfsbackendgoogle.c | |
parent | cbd7bb86723d0cc7bd1b6564a9f60fad616a1771 (diff) | |
download | gvfs-d236257299344207736086400960b0add2c1200b.tar.gz |
google: Fail in-fs copy/move if it leads to display name loss
Complicated file name handling on google backend leads to display name
loss if in-fs copy and move operation is proceeded e.g. using Nautilus.
Proper fix will require larger changes for the whole platform. Therefore
fail the job preferably to avoid display name loss...
https://bugzilla.gnome.org/show_bug.cgi?id=755701
Diffstat (limited to 'daemon/gvfsbackendgoogle.c')
-rw-r--r-- | daemon/gvfsbackendgoogle.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c index 0acec9a3..59e2dfe7 100644 --- a/daemon/gvfsbackendgoogle.c +++ b/daemon/gvfsbackendgoogle.c @@ -1192,6 +1192,22 @@ g_vfs_backend_google_copy (GVfsBackend *_self, } } + etag = gdata_entry_get_etag (source_entry); + id = gdata_entry_get_id (source_entry); + summary = gdata_entry_get_summary (source_entry); + + /* Fail the job if copy/move operation leads to display name loss. + * Use G_IO_ERROR_FAILED instead of _NOT_SUPPORTED to avoid r/w fallback. + * See: https://bugzilla.gnome.org/show_bug.cgi?id=755701 */ + if (g_strcmp0 (id, destination_basename) == 0) + { + g_vfs_job_failed_literal (G_VFS_JOB (job), + G_IO_ERROR, + G_IO_ERROR_FAILED, + _("Operation unsupported")); + goto out; + } + if (destination_not_directory) { g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY, _("The file is not a directory")); @@ -1230,10 +1246,6 @@ g_vfs_backend_google_copy (GVfsBackend *_self, } } - etag = gdata_entry_get_etag (source_entry); - id = gdata_entry_get_id (source_entry); - summary = gdata_entry_get_summary (source_entry); - source_entry_type = G_OBJECT_TYPE (source_entry); dummy_source_entry = g_object_new (source_entry_type, "etag", etag, |