From e200ced4cc46c0b1c8897dbef2f7d3f22bebcef9 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Thu, 14 Mar 2013 10:50:41 -0400 Subject: [PATCH] Bug 9239 QA follow-up: escape quotes in searches This patch escapes quotes in searches for those rare instances where there is a literal quote inside a search term. --- Koha/QueryParser/Driver/PQF/query_plan/node.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Koha/QueryParser/Driver/PQF/query_plan/node.pm b/Koha/QueryParser/Driver/PQF/query_plan/node.pm index 3727e34..2695058 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan/node.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan/node.pm @@ -54,6 +54,7 @@ sub target_syntax { if (@{$self->phrases}) { foreach my $phrase (@{$self->phrases}) { if ($phrase) { + $phrase =~ s/"/\\"/g; $pqf .= ' @or ' x (scalar(@fields) - 1); foreach my $attributes (@fields) { $pqf .= $attributes->{'attr_string'} . ($attributes->{'4'} ? '' : ' @attr 4=1') . ' "' . $phrase . '" '; @@ -66,6 +67,7 @@ sub target_syntax { if (ref($atom)) { $atom_content = $atom->target_syntax($server); if ($atom_content) { + $atom_content =~ s/"/\\"/g; $pqf .= ' @or ' x (scalar(@fields) - 1); foreach my $attributes (@fields) { $attributes->{'attr_string'} ||= ''; -- 1.7.9.5