gnome_vfs_uri_extract_short_name() considered harmful

The function gnome_vfs_uri_extract_short_name() does this:

  - Grab the string after the last slash
  - Unescape that short string

This gives you a raw chunk of bytes.  Since you don't have the encoding
for it, it's useless.

If the URI is a file:// URI for the local host, then the encoding of the
short_name will *hopefully* be G_FILENAME_ENCODING, but that's not
guaranteed.  If what you had is a non-file URI, then the charset could
be anything --- it will be the encoding that the generator used, and you
can't know what it is.

Eel wraps this as eel_uri_get_basename(), which has the exact same
problems.  Gedit has a bug due to this, and I can imagine that programs
which use this functions will have bugs of the same sort.


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