gnome-shell r151 - trunk/js/ui



Author: otaylor
Date: Sat Jan 17 14:41:45 2009
New Revision: 151
URL: http://svn.gnome.org/viewvc/gnome-shell?rev=151&view=rev

Log:
Escape % in g_app_info_create_from_commandline

g_app_info_create_from_commandline supports % escapes for
file name, icon name, etc, so we need to escape the command line
we pass in. If it contains an URL with url-encoded UTF-8 it will
typically have some percent signs.

(Reported by Achim Frase)

Modified:
   trunk/js/ui/docDisplay.js

Modified: trunk/js/ui/docDisplay.js
==============================================================================
--- trunk/js/ui/docDisplay.js	(original)
+++ trunk/js/ui/docDisplay.js	Sat Jan 17 14:41:45 2009
@@ -70,7 +70,13 @@
             log("Will open a document with the following command: " + appExec);
             // TODO: Change this once better support for creating GAppInfo is added to 
             // GtkRecentInfo, as right now this relies on the fact that the file uri is
-            // already a part of appExec, so we don't supply any files to appInfo.launch().   
+            // already a part of appExec, so we don't supply any files to appInfo.launch().
+
+            // The 'command line' passed to create_from_command_line is allowed to contain
+            // '%<something>' macros that are exapnded to file name / icon name, etc,
+            // so we need to escape % as %%
+            appExec = appExec.replace(/%/g, "%%");
+
             let appInfo = Gio.app_info_create_from_commandline(appExec, null, 0, null);
             appInfo.launch([], null, null);
         } else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]