From df9e37de718a73aebb044c03e34593dc8f1c5174 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Thu, 14 Mar 2013 14:02:26 -0400 Subject: [PATCH] Bug 9239 QA follow-up: fix overeager quote escaping The quote escaping added two follow-ups ago was a little too eager, and escaped perfectly valid quotes in some instances. This patch moves the escaping deeper into the loop so that no needed quotes will be escaped. --- Koha/QueryParser/Driver/PQF/query_plan/node.pm | 1 - .../QueryParser/Driver/PQF/query_plan/node/atom.pm | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/QueryParser/Driver/PQF/query_plan/node.pm b/Koha/QueryParser/Driver/PQF/query_plan/node.pm index 2695058..7d05937 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan/node.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan/node.pm @@ -67,7 +67,6 @@ 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'} ||= ''; diff --git a/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm b/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm index 6a69c35..8de250d 100644 --- a/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm +++ b/Koha/QueryParser/Driver/PQF/query_plan/node/atom.pm @@ -22,7 +22,10 @@ directly. sub target_syntax { my ($self, $server) = @_; - return ' "' . $self->content . '" '; + my $content = $self->content; + $content =~ s/"/\\"/g; + + return ' "' . $content . '" '; } 1; -- 1.7.9.5