[gvfs/gnome-3-18] gvfs-open: also replace dashes when computing object path



commit eb7986b8a602411eed46a5036029aab3e7766124
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Thu Jul 7 14:23:17 2016 -0700

    gvfs-open: also replace dashes when computing object path
    
    This is what GApplication does, and we should do it here too, or
    gvfs-open won't work for DBus-activatable applications with dashses in
    their app IDs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=768410

 programs/gvfs-open.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/programs/gvfs-open.c b/programs/gvfs-open.c
index bb518dc..624ac38 100644
--- a/programs/gvfs-open.c
+++ b/programs/gvfs-open.c
@@ -89,8 +89,19 @@ get_bus_name_and_path_from_uri (char *uri,
   bus_name = g_strdup (basename);
   object_path = g_strdup_printf ("/%s", bus_name);
   for (p = object_path; *p != '\0'; p++)
-    if (*p == '.')
-      *p = '/';
+    {
+      if (*p == '.')
+        *p = '/';
+      else if (*p == '-')
+        *p = '_';
+    }
+
+  if (!g_variant_is_object_path (object_path))
+    {
+      g_warning ("Invalid object path \"%s\"", object_path);
+      g_free (object_path);
+      goto out;
+    }
 
   *bus_name_out = g_steal_pointer (&bus_name);
   *object_path_out = g_steal_pointer (&object_path);


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