[Koha-bugs] [Bug 22344] Limits cannot contain parentheses
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Feb 15 03:10:59 CET 2019
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22344
--- Comment #4 from David Cook <dcook at prosentient.com.au> ---
So I wrote the following code:
#Negative lookbehind regex: matches only if the preceding character is not a
backslash
$v =~ s#(?<![\\])\Q(\E#\Q\(\E#g;
$v =~ s#(?<![\\])\Q)\E#\Q\)\E#g;
And I added it into the following block:
if ( $k !~ /mc-i(tem)?type/ ) {
# in case the mc-ccode value has complicating chars like ()'s
inside it we wrap in quotes
$this_limit =~ tr/"//d;
#Negative lookbehind regex: matches only if the preceding
character is not a backslash
$v =~ s#(?<![\\])\Q(\E#\Q\(\E#g;
$v =~ s#(?<![\\])\Q)\E#\Q\)\E#g;
$this_limit = $k.":'".$v."'";
}
That fixed the search. Zebra returned the correct results. However, it did make
the $limit_desc not look nice and it updated the $limit_cgi too, so the escaped
value continues to propagate through as one uses facets and pages and so on.
Fortunately, the regex prevents double-escapes, so nothing breaks, but it's a
little ugly.
Ugly is probably better than broken in any case.
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
More information about the Koha-bugs
mailing list