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



On Fri, 2006-03-24 at 10:54 +0100, Christian Neumair wrote:
> 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.

@@ -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) {


This is wrong, gnome_vfs_uri_append_file_name will escape '/' which is
not right in this case. However gnome_vfs_escape_path_string isn't right
either, as it doesn't escape '&', '=' and '?'. Given a superficial look
this seems bogus though. I can't see any reason for
gnome_vfs_escape_path_string to not escape those. It will only cause
bugs. Maybe I'm missing something here?

@@ -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 ||

Same here.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a benighted vegetarian paramedic in drag. She's an artistic impetuous 
research scientist who can talk to animals. They fight crime! 




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