Bugzilla – Attachment 140709 Details for
Bug 31565
Patron search filter by category code with special character returns no results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31565: Escape datatables MySQL special characters only in LIKE queries
Bug-31565-Escape-datatables-MySQL-special-characte.patch (text/plain), 2.30 KB, created by
Lari Taskula
on 2022-09-16 14:15:25 UTC
(
hide
)
Description:
Bug 31565: Escape datatables MySQL special characters only in LIKE queries
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2022-09-16 14:15:25 UTC
Size:
2.30 KB
patch
obsolete
>From 799f25b8a7dcd6772a6dcdc7763d96d833bacce7 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Fri, 16 Sep 2022 14:05:15 +0000 >Subject: [PATCH] Bug 31565: Escape datatables MySQL special characters only in > LIKE queries > >Escaping \ yields no results when performing exact search in datatables. >This patch adds MySQL special character escaping only to LIKE searches. > >To test: >1. Add following categorycode 'TEST\CAT' by SQL >insert into categories (categorycode,description) values ('TEST\\CAT', 'TEST\\CAT'); >2. Add a patron into TEST\CAT category >3. Go to patron search >4. Limit search by category TEST\CAT >5. Observe no results >6. Apply patch >7. Refresh patron search page >8. Limit search by category TEST\CAT >9. Observe Koha redirecting you to patron you chose in step 2 >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 197c2e09fd..a22d5dd4d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -578,9 +578,6 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { > > function build_query(col, value){ > >- // escape SQL special character \ >- value = value.replace(/(\\)/g, "\\$1" ); >- > var parts = []; > var attributes = col.data.split(':'); > for (var i=0;i<attributes.length;i++){ >@@ -592,7 +589,7 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { > criteria = "exact"; > } else { > // escape SQL LIKE special characters % and _ >- value = value.replace(/(\%|\_)/g, "\\$1"); >+ value = value.replace(/(\%|\_|\\)/g, "\\$1"); > } > part[!attr.includes('.')?'me.'+attr:attr] = criteria === 'exact' > ? value >-- >2.25.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 31565
:
140636
|
140637
|
140709
|
140753
|
140754
|
140755
|
140756
|
140757
|
140758
|
140978
|
140984
|
142861