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
parent
commit
a44d2fd666
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      .copier/update_dotenv.py

6
.copier/update_dotenv.py

@ -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:

Loading…
Cancel
Save