This characters have special meanings in LIKE queries in MariaDB/MySQL and should be escaped correctly. [1] [1] https://dev.mysql.com/doc/refman/8.0/en/string-literals.html
Created attachment 132544 [details] [review] Bug 30393: Make datatables wrapper handle searching for % and _ This patch makes searching for '%' and '_' work by escaping those symbols in the query before sending them to the API. To test: 1. Go to the cities page 2. Add two cities: - 'Cordoba %' - 'Buenos Aires _' 3. Use the column search on the name, alternating _ and % as the query => FAIL: Weird behavior 4. Apply this patch and reload 5. Repeat 3 => SUCCESS: Filtering works correctly! 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 132551 [details] [review] Bug 30393: Make datatables wrapper handle searching for %, _, \ This patch makes searching for '%','_' and '\' work by escaping those symbols in the query before sending them to the API. To test: 1. Go to the cities page 2. Add two cities: - 'Cordoba %' - 'Buenos Aires _' - 'London \' 3. Use the column search on the name, alternating _, \ and % as the query => FAIL: Weird behavior 4. Apply this patch and reload 5. Repeat 3 => SUCCESS: Filtering works correctly! 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 132553 [details] [review] Bug 30393: Make datatables wrapper handle searching for %, _, \ This patch makes searching for '%','_' and '\' work by escaping those symbols in the query before sending them to the API. To test: 1. Go to the cities page 2. Add two cities: - 'Cordoba %' - 'Buenos Aires _' - 'London \' 3. Use the column search on the name, alternating _, \ and % as the query => FAIL: Weird behavior 4. Apply this patch and reload 5. Repeat 3 => SUCCESS: Filtering works correctly! 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Works nice, this is an happy sign-off ! :D
Created attachment 132561 [details] [review] Bug 30393: Make datatables wrapper handle searching for %, _, \ This patch makes searching for '%','_' and '\' work by escaping those symbols in the query before sending them to the API. To test: 1. Go to the cities page 2. Add two cities: - 'Cordoba %' - 'Buenos Aires _' - 'London \' 3. Use the column search on the name, alternating _, \ and % as the query => FAIL: Weird behavior 4. Apply this patch and reload 5. Repeat 3 => SUCCESS: Filtering works correctly! 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Séverine Queune <severine.queune@bulac.fr> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 132597 [details] [review] Bug 30393: Make datatables wrapper handle searching for %, _, \ This patch makes searching for '%','_' and '\' work by escaping those symbols in the query before sending them to the API. To test: 1. Go to the cities page 2. Add two cities: - 'Cordoba %' - 'Buenos Aires _' - 'London \' 3. Use the column search on the name, alternating _, \ and % as the query => FAIL: Weird behavior 4. Apply this patch and reload 5. Repeat 3 => SUCCESS: Filtering works correctly! 6. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Séverine Queune <severine.queune@bulac.fr> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Just adding another QA stamp as I was also working through testing this one.
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Pushed to 21.11.x for 21.11.05