Browse Source
🐛 Fix copier to handle string vars with spaces in quotes (#631)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
pull/13907/head
Esteban Maya
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
1 deletions
-
.copier/update_dotenv.py
|
@ -14,7 +14,11 @@ for line in env_content.splitlines(): |
|
|
for key, value in answers.items(): |
|
|
for key, value in answers.items(): |
|
|
upper_key = key.upper() |
|
|
upper_key = key.upper() |
|
|
if line.startswith(f"{upper_key}="): |
|
|
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) |
|
|
lines.append(new_line) |
|
|
break |
|
|
break |
|
|
else: |
|
|
else: |
|
|