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



Am Donnerstag, den 20.04.2006, 16:53 +0200 schrieb Alexander Larsson:
> 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?

I totally agree. Shouldn't _escape_path_string differ from
_escape_string in allowing '/'? Do you know why _escape_slashes also
allows '%'?

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

-- 
Christian Neumair <chris gnome-de org>




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