Index: vfolder-desktop-method.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/vfolder-desktop-method.c,v
retrieving revision 1.36
diff -u -r1.36 vfolder-desktop-method.c
--- vfolder-desktop-method.c	8 May 2002 06:07:28 -0000	1.36
+++ vfolder-desktop-method.c	8 May 2002 22:36:10 -0000
@@ -455,11 +455,15 @@
 static char *
 get_basename (GnomeVFSURI *uri)
 {
-	const char *path = gnome_vfs_uri_get_path (uri);
+	gchar *path, *base;
+	
+	path = gnome_vfs_unescape_string (uri->text, G_DIR_SEPARATOR_S);
 
-	if (path != NULL)
-		return g_path_get_basename (path);
-	else
+	if (path != NULL) {
+		base = g_path_get_basename (path);
+		g_free (path);
+		return base;
+	} else
 		return NULL;
 }
 
@@ -3261,7 +3265,7 @@
 		} else {
 			return efile_list->data;
 		}
-	} else if (strcmp (basename, ".directory") == 0) {
+	} else if (check_ext (basename, ".directory") == TRUE) {
 		Folder *folder;
 
 		folder = resolve_folder (info, path,
@@ -3682,11 +3686,17 @@
 
 	scheme = gnome_vfs_uri_get_scheme (uri);
 	basename = get_basename (uri);
-	path = gnome_vfs_uri_get_path (uri);
+	path = gnome_vfs_unescape_string (uri->text, G_DIR_SEPARATOR_S);
+
+	/* The check for .tmp is a workaround to void the INVALID URI error,
+	   gnome_vfs async methods try to write a file with the .tmp extension
+	   to check if the file system is writeable, maybe this check is 
+	   needed is also needed in do_unlink */
 	if (scheme == NULL ||
 	    basename == NULL ||
 	    path == NULL ||
 	    ( ! check_ext (basename, ".desktop") &&
+	      ! check_ext (basename, ".tmp") &&
 	      ! strcmp (basename, ".directory") == 0)) {
 		g_free (basename);
 		return GNOME_VFS_ERROR_INVALID_URI;
@@ -4178,8 +4188,8 @@
 	VFolderInfo *info;
 	char *desktop_file;
 
-	path = gnome_vfs_uri_get_path (uri);
 	scheme = gnome_vfs_uri_get_scheme (uri);
+	path = gnome_vfs_unescape_string (uri->text, G_DIR_SEPARATOR_S);
 	if (scheme == NULL)
 		return GNOME_VFS_ERROR_INVALID_URI;
 
@@ -4510,15 +4520,15 @@
 {
 	GnomeVFSResult result = GNOME_VFS_OK;
 	const char *scheme;
-	const char *path;
-	char *basename;
+	const char *unescaped_path;
+	char *basename, *path;
 	VFolderInfo *info;
 	Folder *parent, *folder;
 
 	scheme = gnome_vfs_uri_get_scheme (uri);
-	path = gnome_vfs_uri_get_path (uri);
+	unescaped_path = gnome_vfs_uri_get_path (uri);
 	if (scheme == NULL ||
-	    path == NULL)
+	    unescaped_path == NULL)
 		return GNOME_VFS_ERROR_INVALID_URI;
 
 	if (ALL_SCHEME_P (scheme))
@@ -4532,9 +4542,12 @@
 	    info->read_only)
 		return GNOME_VFS_ERROR_READ_ONLY;
 
+	path = gnome_vfs_unescape_string (unescaped_path, G_DIR_SEPARATOR_S);
 	parent = resolve_folder (info, path,
 				 TRUE /* ignore_basename */,
 				 &result, context);
+	g_free (path);
+	
 	if (parent == NULL)
 		return result;
 
@@ -4573,11 +4586,11 @@
 	GnomeVFSResult result = GNOME_VFS_OK;
 	Folder *folder;
 	const char *scheme;
-	const char *path;
+	char *path;
 	VFolderInfo *info;
 
 	scheme = gnome_vfs_uri_get_scheme (uri);
-	path = gnome_vfs_uri_get_path (uri);
+	path = gnome_vfs_unescape_string (uri->text, G_DIR_SEPARATOR_S);
 	if (scheme == NULL ||
 	    path == NULL)
 		return GNOME_VFS_ERROR_INVALID_URI;
