gvfs r2365 - in trunk: . daemon



Author: otte
Date: Thu Apr  9 09:29:00 2009
New Revision: 2365
URL: http://svn.gnome.org/viewvc/gvfs?rev=2365&view=rev

Log:
2009-04-09  Andreas Henriksson <andreas fatal se>

	reviewed by: Benjamin Otte  <otte gnome org>

	Bug 520399 â Nautilus can't access non-listed (hidden) ftp directory

	* daemon/gvfsbackendftp.c: (create_file_info):
	try CWD and SIZE on paths when we can't list the parent directory



Modified:
   trunk/ChangeLog
   trunk/daemon/gvfsbackendftp.c

Modified: trunk/daemon/gvfsbackendftp.c
==============================================================================
--- trunk/daemon/gvfsbackendftp.c	(original)
+++ trunk/daemon/gvfsbackendftp.c	Thu Apr  9 09:29:00 2009
@@ -2142,6 +2142,52 @@
     }
   ftp->dir_ops->iter_free (iter);
   g_static_rw_lock_reader_unlock (&ftp->directory_cache_lock);
+
+  /* try to find hidden file/directory */
+  if (info == NULL)
+    {
+      if (ftp_connection_try_cd (conn, file))
+        {
+          char *tmp;
+
+          info = g_file_info_new ();
+
+          tmp = g_path_get_basename (filename);
+          g_file_info_set_name (info, tmp);
+          g_free (tmp);
+
+          gvfs_file_info_populate_default (info, filename, G_FILE_TYPE_DIRECTORY);
+
+          g_file_info_set_is_hidden (info, TRUE);
+        }
+      else if (ftp_connection_send (conn, 0, "SIZE %s", file))
+        {
+          char *tmp;
+
+          info = g_file_info_new ();
+
+          tmp = g_path_get_basename (filename);
+          g_file_info_set_name (info, tmp);
+          g_free (tmp);
+
+          gvfs_file_info_populate_default (info, filename, G_FILE_TYPE_REGULAR);
+
+          g_file_info_set_size (info, strtoul (conn->read_buffer+4, NULL, 0));
+
+          g_file_info_set_is_hidden (info, TRUE);
+        }
+      else
+        {
+          /* clear error from ftp_connection_send() in else if line above */
+          ftp_connection_clear_error (conn);
+
+          /* note that there might still be a file/directory, we just have 
+           * no way to figure this out (in particular on ftp servers that 
+           * don't support SIZE.
+           * If you have ways to improve file detection, patches are welcome. */
+        }
+    }
+
   g_free (dir);
   g_free (file);
   return info;



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