[Xfce4-commits] [xfce/exo] 02/02: Escape file names (bug #9912)

noreply at xfce.org noreply at xfce.org
Wed Aug 26 10:15:24 CEST 2015


This is an automated email from the git hooks/post-receive script.

bluesabre pushed a commit to branch master
in repository xfce/exo.

commit 6faf134307a8f651c09931ae4f7017ce141f6320
Author: Felipe Contreras <felipe.contreras at gmail.com>
Date:   Fri Jul 24 11:15:25 2015 -0500

    Escape file names (bug #9912)
    
    Signed-off-by: Felipe Contreras <felipe.contreras at gmail.com>
    Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
 exo-open/main.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/exo-open/main.c b/exo-open/main.c
index 059fad4..119b557 100644
--- a/exo-open/main.c
+++ b/exo-open/main.c
@@ -199,7 +199,16 @@ exo_open_launch_desktop_file (const gchar *arg)
 #endif
 }
 
-
+static gchar *
+exo_open_get_path (const gchar *string)
+{
+  gchar *escaped;
+  gchar *uri;
+  escaped = g_uri_escape_string (string, G_URI_RESERVED_CHARS_ALLOWED_IN_PATH, TRUE);
+  uri = g_strconcat ("file://", escaped, NULL);
+  g_free (escaped);
+  return uri;
+}
 
 static gchar *
 exo_open_find_scheme (const gchar *string)
@@ -210,7 +219,7 @@ exo_open_find_scheme (const gchar *string)
 
   /* is an absolute path, return file uri */
   if (g_path_is_absolute (string))
-    return g_strconcat ("file://", string, NULL);
+    return exo_open_get_path (string);
 
   /* treat it like a relative path */
   current_dir = g_get_current_dir ();
@@ -220,7 +229,7 @@ exo_open_find_scheme (const gchar *string)
   /* verify that a file of the given name exists */
   if (g_file_test (path, G_FILE_TEST_EXISTS))
     {
-       uri = g_strconcat ("file://", path, NULL);
+       uri = exo_open_get_path (path);
        g_free (path);
        return uri;
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list