Author: benny Date: 2007-01-28 13:30:43 +0000 (Sun, 28 Jan 2007) New Revision: 24777
Modified: libexo/trunk/ChangeLog libexo/trunk/exo/exo-url.c Log: 2007-01-28 Benedikt Meurer <[EMAIL PROTECTED]> * exo/exo-url.c(exo_url_show_on_screen): Apply patch from Peter de Ridder <[EMAIL PROTECTED]> to quote URLs properly prior to passing them to external programs. Bug #2791. Modified: libexo/trunk/ChangeLog =================================================================== --- libexo/trunk/ChangeLog 2007-01-28 10:56:17 UTC (rev 24776) +++ libexo/trunk/ChangeLog 2007-01-28 13:30:43 UTC (rev 24777) @@ -1,5 +1,11 @@ 2007-01-28 Benedikt Meurer <[EMAIL PROTECTED]> + * exo/exo-url.c(exo_url_show_on_screen): Apply patch from Peter de + Ridder <[EMAIL PROTECTED]> to quote URLs properly prior to + passing them to external programs. Bug #2791. + +2007-01-28 Benedikt Meurer <[EMAIL PROTECTED]> + * configure.in.in: Bump required HAL version to 0.5.7. Bug #2828. 2007-01-20 Benedikt Meurer <[EMAIL PROTECTED]> Modified: libexo/trunk/exo/exo-url.c =================================================================== --- libexo/trunk/exo/exo-url.c 2007-01-28 10:56:17 UTC (rev 24776) +++ libexo/trunk/exo/exo-url.c 2007-01-28 13:30:43 UTC (rev 24777) @@ -207,6 +207,7 @@ gchar *local_path; gchar *command; gchar *uri; + gchar *quoted_url; gint status; g_return_val_if_fail (url != NULL, FALSE); @@ -260,10 +261,13 @@ } else { + /* make a shell quoted url to pass to other applications */ + quoted_url = g_shell_quote(local_path); + /* but since we have a local file here, maybe the org.xfce.FileManager can open it? */ command = g_strdup_printf ("dbus-send --print-reply --dest=org.xfce.FileManager " "/org/xfce/FileManager org.xfce.FileManager.Launch " - "string:\"%s\" string:\"%s\"", local_path, display_name); + "string:%s string:\"%s\"", quoted_url, display_name); result = (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0); g_free (command); @@ -271,7 +275,7 @@ if (G_UNLIKELY (!result)) { /* but hey, we know that Thunar can open local files, so give it a go */ - command = g_strdup_printf ("Thunar --display=\"%s\" \"%s\"", display_name, local_path); + command = g_strdup_printf ("Thunar --display=\"%s\" %s", display_name, quoted_url); result = g_spawn_command_line_async (command, NULL); g_free (command); } @@ -280,7 +284,7 @@ if (G_UNLIKELY (!result)) { /* gnome-open is also worth a try, since it uses the standard applications database */ - command = g_strdup_printf ("env DISPLAY=\"%s\" gnome-open \"%s\"", display_name, local_path); + command = g_strdup_printf ("env DISPLAY=\"%s\" gnome-open %s", display_name, quoted_url); result = (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0); g_free (command); } @@ -292,6 +296,9 @@ g_set_error (error, EXO_URL_ERROR, EXO_URL_ERROR_NOT_SUPPORTED, _("Unable to open \"%s\""), local_path); } + + /* release the quoted_url as it is no longer needed */ + g_free(quoted_url); } /* release the local path and the display name */ @@ -302,11 +309,17 @@ return result; } + /* make a shell quoted url to pass to other applications */ + quoted_url = g_shell_quote(url); + /* not a local path, and not something that we support, but maybe gnome-open knows what to do */ - command = g_strdup_printf ("env DISPLAY=\"%s\" gnome-open \"%s\"", display_name, url); + command = g_strdup_printf ("env DISPLAY=\"%s\" gnome-open %s", display_name, quoted_url); result = (g_spawn_command_line_sync (command, NULL, NULL, &status, NULL) && status == 0); g_free (command); + /* release the quoted_url as it is no longer needed */ + g_free(quoted_url); + /* check if gnome-open handled the URL */ if (G_UNLIKELY (!result)) { _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits