Re: URIs vs. half-baked URIs (was Filesel drag and drop)



How about a function that verified that a given string is a propely
encoded URI? 

You can't really distinguish between a half-baked URI (or just really
goofy unix filename that might correspond to a literalily saved URI) in
the presence of filenames with % marks inside. 

On Thu, 2 Aug 2001, Darin Adler wrote:

> 
> I know this kind of code is already in GNOME, but eventually we have to 
> distinguish real URIs from half-baked URIs: paths with "file:" or 
> "file://<hostname>" prefixes but without URI escaping. The code above 
> strips the prefix (ignoring the hostname) and then uses the rest as a path.
>   This won't work for files with "%" characters in their name, it won't 
> work properly if the URIs have "%" escape sequences in them, and it will 
> do the wrong thing for URIs with host names (other than the current host) 
> in them.
> 
> I don't mean to pick on Alex, he just happened to be the one who posted 
> the code, but this is a real problem. At some point we have to start 
> distinguishing between places that use real URIs and places that use these 
> kinds of half-baked URIs if we want to be able to drag files that have "%" 
> characters in the file name.
> 
> An easy way to do this correctly for code that can have a gnome-vfs 
> dependency is to use gnome_vfs_get_local_path_from_uri or 
> gnome_vfs_get_uri_from_local_path. Maybe we should put these two functions 
> into glib or somewhere in gtk since it's *so* easy and common to get them 
> wrong, and they affect drag and drop.
> 
> Relevant functions to look at to see the problem in existing GNOME code 
> are gnome_uri_list_extract_filenames, which extracts paths from URIs in 
> this same half-baked way, and add_one_compatible_uri from eel-dnd.c which 
> goes out of its way to construct half-baked URIs that 
> gnome_uri_list_extract_filenames can deal with.
> 
>      -- Darin
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 

	Sander

I haven't been vampired. You've been Weatherwaxed.



_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers




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