[tracker/tracker-0.8] Fixes NB#170915: tracker-search for snippet is resulting in errors



commit cb8e43854bccf475e358c3bf424b618901720e67
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Jun 22 09:30:12 2010 +0200

    Fixes NB#170915: tracker-search for snippet is resulting in errors

 src/tracker-utils/tracker-search.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-utils/tracker-search.c b/src/tracker-utils/tracker-search.c
index 947f209..e29d092 100644
--- a/src/tracker-utils/tracker-search.c
+++ b/src/tracker-utils/tracker-search.c
@@ -161,7 +161,13 @@ get_fts_string (GStrv    search_words,
 	len = g_strv_length (search_words);
 
 	for (i = 0; i < len; i++) {
-		g_string_append (fts, search_words[i]);
+		gchar *escaped;
+
+		/* Properly escape the input string as it's going to be passed
+		 * in a sparql query */
+		escaped = tracker_sparql_escape (search_words[i]);
+
+		g_string_append (fts, escaped);
 
 		if (i < len - 1) {
 			if (use_or_operator) {
@@ -170,6 +176,8 @@ get_fts_string (GStrv    search_words,
 				g_string_append (fts, " ");
 			}
 		}
+
+		g_free (escaped);
 	}
 
 	return g_string_free (fts, FALSE);



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