GNOME Bugzilla – Bug 673500
Partial Crash when using special characters in search
Last modified: 2012-04-16 17:20:01 UTC
If you use the character '\' in a search, it gives an error: Error to fetch the list of documents: Error invoking Tracker.query_finish: syntax error, unexpected character. The program cannot recover from there.It need to be restarted.
Yes, I can reproduce here; this is very likely due to a missing call to Tracker.sparql_escape_string() in searchbar.js:getTerms(). Since the search string is user-input, it needs to be escaped before passing it to Tracker for querying.
Created attachment 211492 [details] [review] Searchbar.js esc seq fix This applies cleanly to master but I haven't been able to test it yet.
Review of attachment 211492 [details] [review]: Thanks for the patch Meg! Some comments below. ::: src/searchbar.js @@ +258,2 @@ getTerms: function() { + let str = Tracker.sparql_escape_string(this._string) Missing semicolon at the end of the line. @@ +260,1 @@ return this._string.replace(/ +/g, ' ').split(' '); Should return str.replace() and not this._string.replace().
Created attachment 212033 [details] [review] New version esc string fix for Searchbar.js
Sorry I didn't notice that you had reviewed this, Cosimo. I made the changes you requested.
Created attachment 212091 [details] [review] esc seq, import state, fixed which string returned. Added import statement. Let me know if it works. Thanks!
Created attachment 212102 [details] [review] put import first so that it hopefully is correct according to style guide https://live.gnome.org/GnomeShell/StyleGuide
Coding style would recommend imports in alphabetical order...anyway I wanted to get this patch into 0.4.1, so I changed the order and pushed it to git master and gnome-3-4 branches. Thanks!
Thanks, I will watch the alphabetizing for imports in the future!