[gnome-control-center/gnome-3-10] printers: Don't fail when adding Samba printers with spaces



commit a53065dbd4cdfdc40c30f72791d118340f0e6b2d
Author: Marek Kasik <mkasik redhat com>
Date:   Thu Mar 27 13:13:31 2014 +0100

    printers: Don't fail when adding Samba printers with spaces
    
    Escape characters in URIs composed for SMB shares since their names
    can contain characters which are not allowed in URIs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699942

 panels/printers/pp-samba.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/panels/printers/pp-samba.c b/panels/printers/pp-samba.c
index 3079990..211a3ec 100644
--- a/panels/printers/pp-samba.c
+++ b/panels/printers/pp-samba.c
@@ -392,6 +392,7 @@ list_dir (SMBCCTX      *smb_context,
         {
           gchar *subdirname = NULL;
           gchar *subpath = NULL;
+          gchar *uri;
 
           if (dirent->smbc_type == SMBC_WORKGROUP)
             {
@@ -409,9 +410,12 @@ list_dir (SMBCCTX      *smb_context,
             {
               device = g_new0 (PpPrintDevice, 1);
 
-              device->device_uri = g_strdup_printf ("%s/%s",
-                                                    dirname,
-                                                    dirent->name);
+              uri = g_strdup_printf ("%s/%s", dirname, dirent->name);
+              device->device_uri = g_uri_escape_string (uri,
+                                                        G_URI_RESERVED_CHARS_GENERIC_DELIMITERS
+                                                        G_URI_RESERVED_CHARS_SUBCOMPONENT_DELIMITERS,
+                                                        FALSE);
+              g_free (uri);
 
               device->device_class = g_strdup ("network");
               device->device_info = g_strdup (dirent->comment);


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