Index: app/file/file-utils.c =================================================================== --- app/file/file-utils.c (revision 22465) +++ app/file/file-utils.c (working copy) @@ -109,12 +109,13 @@ gchar *absolute; gchar *uri; - g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + g_return_val_if_fail (gimp == NULL || GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); /* check for prefixes like http or ftp */ - if (file_proc_find_by_prefix (gimp->plug_in_manager->load_procs, + if (gimp && + file_proc_find_by_prefix (gimp->plug_in_manager->load_procs, filename, FALSE)) { if (g_utf8_validate (filename, -1, NULL)) @@ -140,13 +141,23 @@ if (! strcmp (scheme, canon) && g_ascii_isgraph (canon[0])) { - g_set_error (error, G_FILE_ERROR, 0, - _("URI scheme '%s:' is not supported"), scheme); + if (gimp) + { + g_set_error (error, G_FILE_ERROR, 0, + _("URI scheme '%s:' is not supported"), scheme); - g_free (scheme); - g_free (canon); + g_free (scheme); + g_free (canon); - return NULL; + return NULL; + } + else + { + g_free (scheme); + g_free (canon); + + return g_strdup (filename); + } } g_free (scheme); @@ -180,7 +191,7 @@ { gchar *uri; - g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + g_return_val_if_fail (gimp == NULL || GIMP_IS_GIMP (gimp), NULL); g_return_val_if_fail (filename_or_uri != NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); @@ -704,27 +715,27 @@ c = *in; if (c == '%') - { - /* catch partial escape sequences past the end of the substring */ - if (in + 3 > in_end) - break; + { + /* catch partial escape sequences past the end of the substring */ + if (in + 3 > in_end) + break; - c = unescape_character (in + 1); + c = unescape_character (in + 1); - /* catch bad escape sequences and NUL characters */ - if (c <= 0) - break; + /* catch bad escape sequences and NUL characters */ + if (c <= 0) + break; - /* catch escaped ASCII */ - if (ascii_must_not_be_escaped && c <= 0x7F) - break; + /* catch escaped ASCII */ + if (ascii_must_not_be_escaped && c <= 0x7F) + break; - /* catch other illegal escaped characters */ - if (strchr (illegal_escaped_characters, c) != NULL) - break; + /* catch other illegal escaped characters */ + if (strchr (illegal_escaped_characters, c) != NULL) + break; - in += 2; - } + in += 2; + } *out++ = c; } Index: app/main.c =================================================================== --- app/main.c (revision 22465) +++ app/main.c (working copy) @@ -54,6 +54,7 @@ #include "config/gimpconfig-dump.h" #include "core/gimp.h" +#include "file/file-utils.h" #include "widgets/gimpdbusservice.h" @@ -346,7 +347,7 @@ { if (error) { - gimp_open_console_window (); + gimp_open_console_window (); g_print ("%s\n", error->message); g_error_free (error); } @@ -715,12 +716,26 @@ for (i = 0, success = TRUE; filenames[i] && success; i++) { gboolean retval; /* ignored */ + gchar *uri; - success = dbus_g_proxy_call (proxy, method, &error, - G_TYPE_STRING, filenames[i], - G_TYPE_INVALID, - G_TYPE_BOOLEAN, &retval, - G_TYPE_INVALID); + uri = file_utils_any_to_uri (NULL, filenames[i], &error); + + if (uri) + { + success = dbus_g_proxy_call (proxy, method, &error, + G_TYPE_STRING, uri, + G_TYPE_INVALID, + G_TYPE_BOOLEAN, &retval, + G_TYPE_INVALID); + + g_free (uri); + } + else + { + g_printerr ("conversion filename -> uri failed: %s\n", + error->message); + g_clear_error (&error); + } } } else