Sophie

Sophie

distrib > Mageia > 5 > x86_64 > by-pkgid > 07889aa078f2dd513f096cfda00d1d65 > files > 1

libfm-1.2.3-4.mga5.src.rpm

From 6680cbd2085659f476bb206c5180b33491d7f65d Mon Sep 17 00:00:00 2001
From: Andriy Grytsenko <andrej@rep.kiev.ua>
Date: Mon, 29 Dec 2014 23:46:55 +0200
Subject: [PATCH] [SF#922]Fix handling %c in desktop entry Exec key.

The launch may fail if the application name contains spaces.
---
 NEWS                   | 7 ++++++-
 src/base/fm-app-info.c | 6 +++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 58ee98a..0356f25 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,9 @@
-* Fixed crash in templates on file that was deleted instantly after creation.
+* Fixed crash in templates on file that was deleted instantly after
+    creation.
+
+* Fixed handling %c in desktop entry Exec key: launch may fail if the
+    application name contains spaces so it needs quoting.
+
 
 Changes on 1.2.3 since 1.2.2:
 
diff --git a/src/base/fm-app-info.c b/src/base/fm-app-info.c
index 1578702..c374982 100644
--- a/src/base/fm-app-info.c
+++ b/src/base/fm-app-info.c
@@ -149,7 +149,11 @@ static char* expand_exec_macros(GAppInfo* app, const char* full_desktop_path,
                 {
                     const char* name = g_app_info_get_name(app);
                     if(name)
-                        g_string_append(cmd, name);
+                    {
+                        char *quoted = g_shell_quote(name);
+                        g_string_append(cmd, quoted);
+                        g_free(quoted);
+                    }
                     break;
                 }
             case 'k':
-- 
2.1.3