[Xfce4-commits] <midori:master> Don't quote commands containing tokens
Christian Dywan
noreply at xfce.org
Sun Jul 8 21:30:01 CEST 2012
Updating branch refs/heads/master
to a0b202055077477a88ed410a168986cdf14e1f5b (commit)
from 4073c145468e540d773f6e3064f449dfc4470529 (commit)
commit a0b202055077477a88ed410a168986cdf14e1f5b
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Jul 8 21:02:06 2012 +0200
Don't quote commands containing tokens
extensions/addons.c | 2 +-
midori/midori-browser.c | 2 +-
midori/sokoke.c | 14 ++++++++++----
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/extensions/addons.c b/extensions/addons.c
index 4ab06c2..ad705a1 100644
--- a/extensions/addons.c
+++ b/extensions/addons.c
@@ -491,7 +491,7 @@ addons_open_in_editor_clicked_cb (GtkWidget* toolitem,
g_object_get (settings, "text-editor", &text_editor, NULL);
if (text_editor && *text_editor)
- sokoke_spawn_program (text_editor, FALSE, element->fullpath, TRUE);
+ sokoke_spawn_program (text_editor, TRUE, element->fullpath, TRUE);
else
{
gchar* element_uri = g_filename_to_uri (element->fullpath, NULL, NULL);
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 8378ea8..e765cde 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -3498,7 +3498,7 @@ _action_source_view_activate (GtkAction* action,
}
else
{
- sokoke_spawn_program (text_editor, FALSE, filename, TRUE);
+ sokoke_spawn_program (text_editor, TRUE, filename, TRUE);
g_free (filename);
}
g_free (text_editor);
diff --git a/midori/sokoke.c b/midori/sokoke.c
index 18ab9c9..2dfc6e1 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -408,15 +408,15 @@ sokoke_prepare_command (const gchar* command,
gchar* real_command;
gchar* command_ready;
- real_command = quote_command ? g_shell_quote (command) : g_strdup (command);
-
/* .desktop files accept %u, %U, %f, %F as URI/ filename, we treat it like %s */
+ real_command = g_strdup (command);
if ((uri_format = strstr (real_command, "%u"))
|| (uri_format = strstr (real_command, "%U"))
|| (uri_format = strstr (real_command, "%f"))
|| (uri_format = strstr (real_command, "%F")))
uri_format[1] = 's';
+
if (strstr (real_command, "%s"))
{
gchar* argument_quoted = quote_argument ? g_shell_quote (argument) : g_strdup (argument);
@@ -425,12 +425,18 @@ sokoke_prepare_command (const gchar* command,
}
else if (quote_argument)
{
+ gchar* quoted_command = quote_command ? g_shell_quote (real_command) : g_strdup (real_command);
gchar* argument_quoted = g_shell_quote (argument);
- command_ready = g_strconcat (real_command, " ", argument_quoted, NULL);
+ command_ready = g_strconcat (quoted_command, " ", argument_quoted, NULL);
g_free (argument_quoted);
+ g_free (quoted_command);
}
else
- command_ready = g_strconcat (real_command, " ", argument, NULL);
+ {
+ gchar* quoted_command = quote_command ? g_shell_quote (real_command) : g_strdup (real_command);
+ command_ready = g_strconcat (quoted_command, " ", argument, NULL);
+ g_free (quoted_command);
+ }
g_free (real_command);
return command_ready;
}
More information about the Xfce4-commits
mailing list