AutoSuggest: Escape ampersands properly
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 18 Apr 2012 14:41:27 +0000 (10:41 -0400)
committerDan Scott <dan@coffeecode.net>
Wed, 9 May 2012 04:23:07 +0000 (00:23 -0400)
This fixes an issue reported by Yamil Suarez.

If you had relatively technical users composing searches with
QueryParser syntax, or if they were just typing ampersands for any
other reason, AutoSuggest would behave as if the ampersand marked the end
of user input.

This is fixed by applying the correct URI-encoding function for the
situation.

To be clear, QueryParser syntax does not actually affect suggestions;
such syntax is ignored.  AutoSuggest is not search.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>

Open-ILS/web/js/dojo/openils/AutoSuggestStore.js

index b36b6a4..d598159 100644 (file)
@@ -132,7 +132,7 @@ if (!dojo._hasResource["openils.AutoSuggestStore"]) {
             term = term.replace(/\*$/, "");
 
             var params = [
-                "query=" + encodeURI(term),
+                "query=" + encodeURIComponent(term),
                 "search_class=" + this.type_selector.value,
                 "limit=" + limit
             ];