From: Thierry Parmentelat Date: Wed, 17 Apr 2019 15:01:43 +0000 (+0200) Subject: modify the way PostgreSQL quotes backslashes X-Git-Tag: plcapi-7.1-0~9 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=5dc4edb45e7477a95ae7a7a3bb30662b9ba6bfff;p=plcapi.git modify the way PostgreSQL quotes backslashes this is for SFA and namely from fed4fire, who use hrn's that have backslashes in them so as to escape dots in hrns, when they are meant for FQDN-hostnames --- diff --git a/PLC/PostgreSQL.py b/PLC/PostgreSQL.py index dcf0608d..bf467dd0 100644 --- a/PLC/PostgreSQL.py +++ b/PLC/PostgreSQL.py @@ -68,7 +68,12 @@ class PostgreSQL: x = x.decode('utf-8') if isinstance(x, str): - x = x.replace("\\", "\\\\").replace("'", "''") + # don't double quote backslahes, this causes failure + # with e.g. the SFA code when it tries to spot slices + # created from fed4fire, which to my knowledge is the only + # place where a backslash is useful + # x = x.replace("\\", "\\\\") + x = x.replace("'", "''") x = f"'{x}'" elif isinstance(x, (int, float)): pass