🐛 Fix copier to handle string vars with spaces in quotes (#631)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
Esteban Maya
2024-03-07 12:51:14 -05:00
committed by GitHub
parent f3d6b1c435
commit a44d2fd666

View File

@@ -14,7 +14,11 @@ for line in env_content.splitlines():
for key, value in answers.items():
upper_key = key.upper()
if line.startswith(f"{upper_key}="):
new_line = line.replace(line, f"{upper_key}={value}")
if " " in value:
content = f"{upper_key}={value!r}"
else:
content = f"{upper_key}={value}"
new_line = line.replace(line, content)
lines.append(new_line)
break
else: