[nautilus] tag-manager: Escape uris



commit f6ddc8e149d840ad9ba4089e2a90c89440c59628
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Feb 13 13:04:54 2018 +0100

    tag-manager: Escape uris
    
    Files with apostrophes couldn't be starred because tracker cannot handle
    non ascii characters.
    
    So escape the uris of files before sending them to tracker.
    
    Closes https://gitlab.gnome.org/GNOME/nautilus/issues/163

 src/nautilus-tag-manager.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-tag-manager.c b/src/nautilus-tag-manager.c
index be8797e79..601848675 100644
--- a/src/nautilus-tag-manager.c
+++ b/src/nautilus-tag-manager.c
@@ -108,24 +108,24 @@ add_selection_filter (GList   *selection,
 {
     NautilusFile *file;
     GList *l;
-    gchar *uri;
 
     g_string_append (query, " FILTER(?url IN (");
 
     for (l = selection; l != NULL; l = l->next)
     {
+        g_autofree gchar *uri = NULL;
+        g_autofree gchar *escaped_uri = NULL;
+
         file = l->data;
 
         uri = nautilus_file_get_uri (file);
-
-        g_string_append_printf (query, "'%s'", uri);
+        escaped_uri = tracker_sparql_escape_string (uri);
+        g_string_append_printf (query, "'%s'", escaped_uri);
 
         if (l->next != NULL)
         {
             g_string_append (query, ", ");
         }
-
-        g_free (uri);
     }
 
     g_string_append (query, "))");


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