Move search query input cleansing to the server side
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Oct 2008 15:35:37 +0000 (15:35 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 9 Oct 2008 15:35:37 +0000 (15:35 +0000)
Backport of 10805 from trunk, but we leave backslash cleansing on the client
  in rel_1_2 because backslashes reportedly cause problems with old-style JSON

git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@10806 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/web/opac/skin/default/js/search_bar.js

index d9cb12d..d60b64d 100644 (file)
@@ -461,7 +461,7 @@ sub multiclass_query {
     my $orig_query = $query;
 
     $query =~ s/\+/ /go;
-    $query =~ s/'//go;
+    $query =~ s/'/ /go;
     $query =~ s/^\s+//go;
 
     # convert convenience classes (e.g. kw for keyword) to the full class name
index 5b6cccb..f9382e8 100644 (file)
@@ -56,10 +56,8 @@ function searchBarSubmit(isFilterSort) {
 
        if(!text || text == "") return;
 
-    text = text.replace(/'/g,' ');
+       /* old JSON format breaks horribly if fed backslashes */
     text = text.replace(/\\/g,' ');
-    text = text.replace(/^\s*/,'');
-    text = text.replace(/\s*$/,'');
 
        var d   = (newSearchDepth != null) ?  newSearchDepth : depthSelGetDepth();
        if(isNaN(d)) d = 0;