After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 673500 - Partial Crash when using special characters in search
Partial Crash when using special characters in search
Status: RESOLVED FIXED
Product: gnome-documents
Classification: Core
Component: general
0.4.x
Other Linux
: Normal major
: ---
Assigned To: GNOME documents maintainer(s)
GNOME documents maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-04-04 12:25 UTC by Anna Zacchi
Modified: 2012-04-16 17:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Searchbar.js esc seq fix (624 bytes, patch)
2012-04-06 17:38 UTC, Meg Ford
needs-work Details | Review
New version esc string fix for Searchbar.js (756 bytes, patch)
2012-04-14 03:01 UTC, Meg Ford
none Details | Review
esc seq, import state, fixed which string returned. (1.00 KB, patch)
2012-04-15 18:36 UTC, Meg Ford
none Details | Review
put import first so that it hopefully is correct according to style guide https://live.gnome.org/GnomeShell/StyleGuide (908 bytes, patch)
2012-04-15 21:10 UTC, Meg Ford
committed Details | Review

Description Anna Zacchi 2012-04-04 12:25:19 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.
Comment 1 Cosimo Cecchi 2012-04-04 22:00:59 UTC
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.
Comment 2 Meg Ford 2012-04-06 17:38:31 UTC
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.
Comment 3 Cosimo Cecchi 2012-04-09 14:59:35 UTC
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().
Comment 4 Meg Ford 2012-04-14 03:01:55 UTC
Created attachment 212033 [details] [review]
New version esc string fix for Searchbar.js
Comment 5 Meg Ford 2012-04-14 03:03:09 UTC
Sorry I didn't notice that you had reviewed this, Cosimo. I made the changes you requested.
Comment 6 Meg Ford 2012-04-15 18:36:14 UTC
Created attachment 212091 [details] [review]
esc seq, import state, fixed which string returned. 

Added import statement. Let me know if it works. Thanks!
Comment 7 Meg Ford 2012-04-15 21:10:53 UTC
Created attachment 212102 [details] [review]
put import first so that it hopefully is correct according to style guide https://live.gnome.org/GnomeShell/StyleGuide
Comment 8 Cosimo Cecchi 2012-04-16 14:24:02 UTC
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!
Comment 9 Meg Ford 2012-04-16 17:20:01 UTC
Thanks, I will watch the alphabetizing for imports in the future!