[Koha-patches] [PATCH] [SIGNED-OFF] Escape the double quotes in authority search queries to prevent errors.

Julian Maurice julian.maurice at biblibre.com
Fri Apr 1 09:16:51 CEST 2011


From: Frédérick Capovilla <frederick.capovilla at sys-tech.net>

Before this fix, any search with double-quotes would return an error
500.

Signed-off-by: Julian Maurice <julian.maurice at biblibre.com>
---
 C4/AuthoritiesMarc.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index 1eeb964..0122ca8 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -246,6 +246,7 @@ sub SearchAuthorities {
                 } else {
                     $attr .=" \@attr 5=1 \@attr 4=6 ";## Word list, right truncated, anywhere
                 }
+                @$value[$i] =~ s/"/\\"/g; # Escape the double-quotes in the search value
                 $attr =$attr."\"".@$value[$i]."\"";
                 $q2 .=$attr;
                 $dosearch=1;
-- 
1.7.4.1



More information about the Koha-patches mailing list