From c5b480b2507a278eae25ce7c215ef47af59917e7 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 6 Sep 2023 19:08:54 +0300 Subject: Replace escape with conn.escape_string * wqflask/wqflask/do_search.py (DoSearch.mescape): Replace escape with conn.escape_string. Signed-off-by: Munyoki Kilyungi --- wqflask/wqflask/do_search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py index 7f5e0155..dc0093eb 100644 --- a/wqflask/wqflask/do_search.py +++ b/wqflask/wqflask/do_search.py @@ -6,6 +6,7 @@ import string from wqflask.database import database_connection from utility.db_tools import escape +from wqflask.database import database_connection import sys @@ -49,7 +50,10 @@ class DoSearch: def mescape(self, *items): """Multiple escape""" - escaped = [escape(str(item)) for item in items] + from utility.tools import get_setting + escaped = [] + with database_connection(get_setting("SQL_URI")) as conn: + escaped = [conn.escape_string(str(item)).decode() for item in items] return tuple(escaped) def normalize_spaces(self, stringy): -- cgit v1.2.3