when the filename cannot be converted to UTF-8, warn and return the URI

2004-10-29  Sven Neumann  <sven@gimp.org>

	* app/file/file-utils.c (file_utils_uri_to_utf8_filename): when
	the filename cannot be converted to UTF-8, warn and return the URI
	instead. This is a workaround for the crash described in bug #153751.
This commit is contained in:
Sven Neumann 2004-10-29 13:04:04 +00:00 committed by Sven Neumann
parent 4a4a1096d5
commit d001c17785
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2004-10-29 Sven Neumann <sven@gimp.org>
* app/file/file-utils.c (file_utils_uri_to_utf8_filename): when
the filename cannot be converted to UTF-8, warn and return the URI
instead. This is a workaround for the crash described in bug #153751.
2004-10-29 Michael Natterer <mitch@gimp.org>
* app/dialogs/dialogs.c (toplevel_entries): added foreign entries

View File

@ -256,15 +256,21 @@ file_utils_uri_to_utf8_filename (const gchar *uri)
if (! strncmp (uri, "file:", strlen ("file:")))
{
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
gchar *filename = g_filename_from_uri (uri, NULL, NULL);
if (filename)
{
gchar *utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
GError *error = NULL;
gchar *utf8;
utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, &error);
g_free (filename);
return utf8;
if (utf8)
return utf8;
g_warning ("%s: cannot convert filename to UTF-8: %s",
G_STRLOC, error->message);
g_error_free (error);
}
}