summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine A <>2024-04-16 15:26:07 +0900
committerAntoine A <>2024-04-16 15:26:07 +0900
commitbb5d1d0ceecfb59903cccfba0a2e13f77e39e956 (patch)
tree5ab44f3dc4f610b1a33e60e9783cf4fc7e4f3bed
parent99372f3ea2192b1a6d6d5e79eb878cc17735acec (diff)
downloaddeployment-bb5d1d0ceecfb59903cccfba0a2e13f77e39e956.tar.gz
deployment-bb5d1d0ceecfb59903cccfba0a2e13f77e39e956.tar.bz2
deployment-bb5d1d0ceecfb59903cccfba0a2e13f77e39e956.zip
Fix config escaping
-rwxr-xr-xregional-currency/config.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/regional-currency/config.py b/regional-currency/config.py
index a4bdf3d..107e535 100755
--- a/regional-currency/config.py
+++ b/regional-currency/config.py
@@ -36,7 +36,7 @@ def load_conf() -> Dict[str, str]:
if v.startswith('"') and v.endswith('"'):
conf[k] = v.strip('"').replace('\\"', '"')
elif v.startswith("'") and v.endswith("'"):
- conf[k] = v.strip("'").replace("\\'", "'")
+ conf[k] = v.strip("'").replace("'\\''", "'").replace("\\'", "'")
else:
conf[k] = v
return conf
@@ -52,8 +52,8 @@ def add_conf(name: str, value: str):
result_conf[name] = value
content = ""
for key, value in conf.items():
- escaped = value.replace("'", "\\'")
- content += f"{key}='{escaped}'\n"
+ escaped = value.replace("'", "'\\''")
+ content += f"export {key}='{escaped}'\n"
with open(CONFIG_FILE, "w") as f:
f.write(content)
@@ -472,7 +472,7 @@ if ask_yes_no(
content = ""
for key, value in result_conf.items():
- escaped = value.replace("'", "\\'")
+ escaped = value.replace("'", "'\\''")
content += f"export {key}='{escaped}'\n"
with os.fdopen(3, "w") as f:
f.write(content)