Bugzilla – Attachment 37920 Details for
Bug 10131
System preference search doesn't work for search terms starting with *
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 10131: Add a fallback if the pref search is not a valid regex
PASSED-QA-Bug-10131-Add-a-fallback-if-the-pref-sea.patch (text/plain), 1.55 KB, created by
Katrin Fischer
on 2015-04-15 20:42:40 UTC
(
hide
)
Description:
[PASSED QA] Bug 10131: Add a fallback if the pref search is not a valid regex
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-04-15 20:42:40 UTC
Size:
1.55 KB
patch
obsolete
>From 7b425ef29de7dadea3ddff7e9f2860c5bfdebb5f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 14 Apr 2015 13:45:14 +0200 >Subject: [PATCH] [PASSED QA] Bug 10131: Add a fallback if the pref search is > not a valid regex > >It's possible to search prefs using a regex. >But it the regex is not correctly written, the app explodes. >We should provide a fallback. > >Test plan: >0/ Does not apply the patch >1/ Search for sysprefs with "notes.*", note the number of results >2/ Search for *notes*, boom >3/ Apply the patch >4/ Repeat 1 and confirm you get the same number of results >5/ Repeat 2 and confirm you don't get the error anymore > >NOTE: As noted on comment #4, the kaboom is because of the > leading * and not the following *, because 's*' is a valid > regular expression, while '*n' is not. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > admin/preferences.pl | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/admin/preferences.pl b/admin/preferences.pl >index a6b4776..4fc2612 100755 >--- a/admin/preferences.pl >+++ b/admin/preferences.pl >@@ -271,7 +271,15 @@ sub SearchPrefs { > > sub matches { > my ( $text, $terms ) = @_; >- if ( $text ) { return !grep( { $text !~ /$_/i } @$terms ); } >+ if ( $text ) { >+ return !grep( >+ { >+ my $re = eval{qr|$_|i}; >+ $re = qr|\Q$_\E| if $@; >+ $text !~ m|$re|; >+ } @$terms >+ ) >+ } > } > > my $dbh = C4::Context->dbh; >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10131
:
37818
|
37825
|
37826
| 37920