]> spindle.queued.net Git - midori/commitdiff
Don't quote commands containing tokens
authorChristian Dywan <christian@twotoasts.de>
Sun, 8 Jul 2012 19:02:06 +0000 (21:02 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 8 Jul 2012 19:02:06 +0000 (21:02 +0200)
extensions/addons.c
midori/midori-browser.c
midori/sokoke.c

index 4ab06c2b100393d6b426a1c0380de8dc10776bcf..ad705a118e20c7a75f782cccb8ae690836bbdecc 100644 (file)
@@ -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);
index 8378ea81ed1207cf9abb0487e5d8878b59592c94..e765cdecbcda0cab42e9347ec9f3275f1ce6b207 100644 (file)
@@ -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);
index 18ab9c9eeba0e7b6707738322e72d8b3b54d93ce..2dfc6e117aba1291f8056b693a594000b4fe3dc1 100644 (file)
@@ -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;
     }