Bug 29418: Make clean_search_term escape double quotes
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 4 Jul 2022 18:19:27 +0000 (15:19 -0300)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Thu, 14 Jul 2022 19:40:22 +0000 (21:40 +0200)
commitcc418a482a2b9e3b4cb6f8f491d2aaa233a4480b
tree87b49529c93177397d5be6ea2c1d92636a3e9026
parent22b15df7ff133a68d4fd19476ca1cce32802ff70
Bug 29418: Make clean_search_term escape double quotes

We noticed that several characters will break Zebra queries. So search
terms need to be quoted for things to work. In this context, double
quotes inside search terms are problematic because double quotes are
what we use for quoting strings.

This patch makes the clean_search_term method escape double quotes.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/Koha/SearchEngine/Zebra/QueryBuilder.t
=> FAIL: It doesn't work as it should!
3. Apply this patch
4. Repeat 2
=> SUCCESS: It does the job!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Koha/SearchEngine/Zebra/QueryBuilder.pm