Skip to content

Commit a44d2fd

Browse files
estebanx64tiangolo
andauthored
🐛 Fix copier to handle string vars with spaces in quotes (fastapi#631)
Co-authored-by: Sebastián Ramírez <[email protected]>
1 parent f3d6b1c commit a44d2fd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.copier/update_dotenv.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
for key, value in answers.items():
1515
upper_key = key.upper()
1616
if line.startswith(f"{upper_key}="):
17-
new_line = line.replace(line, f"{upper_key}={value}")
17+
if " " in value:
18+
content = f"{upper_key}={value!r}"
19+
else:
20+
content = f"{upper_key}={value}"
21+
new_line = line.replace(line, content)
1822
lines.append(new_line)
1923
break
2024
else:

0 commit comments

Comments
 (0)