! [PATCH] Use append_file_name instead of append_string in Xfer code



While trying to debug a lossy ext3->vfs copy I stumbled across a major
bug which makes copying break for filenames that contain a '#'
character. At least some of the Xfer code formerly used a helper which
made GnomeVFS interpret reserved characters, splitting the filename at
the '#' position, and appending the rest to the fragment ID of the URI.

The Xfer process itself is quite fragile in some areas as well, I'm
currently investigating that issue.

-- 
Christian Neumair <chris gnome-de org>
Index: libgnomevfs/gnome-vfs-xfer.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-xfer.c,v
retrieving revision 1.136
diff -u -p -r1.136 gnome-vfs-xfer.c
--- libgnomevfs/gnome-vfs-xfer.c	20 Mar 2006 12:16:54 -0000	1.136
+++ libgnomevfs/gnome-vfs-xfer.c	24 Mar 2006 09:17:48 -0000
@@ -513,7 +514,7 @@ PrependOneURIToList (const gchar *rel_pa
 	PrependOneURIParams *params;
 
 	params = (PrependOneURIParams *)cast_to_params;
-	params->uri_list = g_list_prepend (params->uri_list, gnome_vfs_uri_append_string (
+	params->uri_list = g_list_prepend (params->uri_list, gnome_vfs_uri_append_file_name (
 		params->base_uri, rel_path));
 
 	if (recursing_will_loop) {
@@ -874,10 +875,10 @@ handle_merged_name_conflict_visit (const
 	skip = FALSE;
 	result = GNOME_VFS_OK;
 	target_info = gnome_vfs_file_info_new ();
-	target_uri = gnome_vfs_uri_append_string (params->target_uri, rel_path);
+	target_uri = gnome_vfs_uri_append_file_name (params->target_uri, rel_path);
 	if (gnome_vfs_get_file_info_uri (target_uri, target_info, GNOME_VFS_FILE_INFO_DEFAULT) == GNOME_VFS_OK) {
 		source_info = gnome_vfs_file_info_new ();
-		source_uri = gnome_vfs_uri_append_string (params->source_uri, rel_path);
+		source_uri = gnome_vfs_uri_append_file_name (params->source_uri, rel_path);
 		
 		if (gnome_vfs_get_file_info_uri (source_uri, source_info, GNOME_VFS_FILE_INFO_DEFAULT) == GNOME_VFS_OK) {
 			if (target_info->type != GNOME_VFS_FILE_TYPE_DIRECTORY ||
@@ -1800,7 +1846,7 @@ copy_items (const GList *source_uri_list
 			for (count = 1; ; count++) {
 				GnomeVFSXferOverwriteMode overwrite_mode_abort;
 
-				target_uri = gnome_vfs_uri_append_string
+				target_uri = gnome_vfs_uri_append_file_name
 					(target_dir_uri, 
 					 progress->progress_info->duplicate_name);
 
@@ -1939,7 +1986,7 @@ move_items (const GList *source_uri_list
 
 		do {
 			retry = FALSE;
-			target_uri = gnome_vfs_uri_append_string (target_dir_uri, 
+			target_uri = gnome_vfs_uri_append_file_name (target_dir_uri, 
 				 progress->progress_info->duplicate_name);
 
 			progress->progress_info->file_size = 0;
@@ -2048,7 +2095,7 @@ link_items (const GList *source_uri_list
 
 		do {
 			retry = FALSE;
-			target_uri = gnome_vfs_uri_append_string
+			target_uri = gnome_vfs_uri_append_file_name
 				(target_dir_uri,
 				 progress->progress_info->duplicate_name);
 
@@ -2259,7 +2306,7 @@ gnome_vfs_new_directory_with_unique_name
 
 	for (conflict_count = 1; ; conflict_count++) {
 
-		target_uri = gnome_vfs_uri_append_string
+		target_uri = gnome_vfs_uri_append_file_name
 			(target_dir_uri, 
 			 progress->progress_info->duplicate_name);
 		result = create_directory (target_uri, 


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