From 0e31e1fd14d35b1caef49ce18e0dbd8980b30c0f Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 26 Sep 2016 21:56:19 +0200 Subject: [PATCH] server/search: fix underscores and percentages Escape them for LIKE statements. --- server/szurubooru/search/configs/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/szurubooru/search/configs/util.py b/server/szurubooru/search/configs/util.py index 28418db3..d3cb5849 100644 --- a/server/szurubooru/search/configs/util.py +++ b/server/szurubooru/search/configs/util.py @@ -5,7 +5,10 @@ from szurubooru.search import criteria def wildcard_transformer(value): - return value.replace('*', '%') + return (value + .replace('%', r'\%') + .replace('_', r'\_') + .replace('*', '%')) def apply_num_criterion_to_column(column, criterion):