[gnome-documents] searchbar: escape user search string before passing it to Tracker



commit a9f46f894d95055104725eed585ed6282ecc0090
Author: Meg Ford <meg387 gmail com>
Date:   Sun Apr 15 15:57:36 2012 -0500

    searchbar: escape user search string before passing it to Tracker
    
    Since the string is user-input it needs to be escaped before passing it
    to Tracker for querying, or we will error out when using special
    characters as part of the query string.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673500

 src/searchbar.js |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/searchbar.js b/src/searchbar.js
index 89c1b8b..4aa9921 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -23,6 +23,7 @@ const Gd = imports.gi.Gd;
 const Gdk = imports.gi.Gdk;
 const Gtk = imports.gi.Gtk;
 const GtkClutter = imports.gi.GtkClutter;
+const Tracker = imports.gi.Tracker;
 const _ = imports.gettext.gettext;
 
 const Lang = imports.lang;
@@ -256,7 +257,8 @@ SearchController.prototype = {
     },
 
     getTerms: function() {
-        return this._string.replace(/ +/g, ' ').split(' ');
+	let str = Tracker.sparql_escape_string(this._string);
+        return str.replace(/ +/g, ' ').split(' ');
     },
 
     setDropownState: function(state) {



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