From e712065f4093aae593ace21dd9d8127d15621a51 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Mon, 13 Feb 2012 14:57:39 -0500 Subject: [PATCH] AutoSuggest: prevent building a bad tsquery when user types leading spaces The problem used to bubble up and manifest as an Apache 500 error for the user. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Mike Rylander --- Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm index 3e4d18247d..cf8644bc1b 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/AutoSuggest.pm @@ -58,7 +58,7 @@ sub prepare_for_tsquery { $str =~ s/[^\w\s]/ /ig; $str .= ":*" unless $str =~ /\s$/; - return join(" & ", split(/\s+/, $str)); + return join(" & ", grep(length, split(/\s+/, $str))); } # The third argument to our stored procedure, metabib.suggest_browse_entries(), -- 2.11.0