From b6ec5080c887fb9e05d134bde0135727fc278a13 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sat, 17 Jan 2009 14:41:45 +0000 Subject: [PATCH] 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) svn path=/trunk/; revision=151 --- js/ui/docDisplay.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js index c9af0cf54..436385d35 100644 --- a/js/ui/docDisplay.js +++ b/js/ui/docDisplay.js @@ -70,7 +70,13 @@ DocDisplayItem.prototype = { 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 + // '%' 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 {