mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
generate_secrets: Fix handling of missing trailing newlines.
When we added support for automatically adding new secrets in generate_secrets.py, we failed to account for the possibility that a human editor might have let the secrets file without a trailing newline. We address this by adding a leading newline before our new secret. Fixes #5209.
This commit is contained in:
@@ -108,7 +108,9 @@ def generate_secrets(development=False):
|
||||
return
|
||||
|
||||
out = open(OUTPUT_SETTINGS_FILENAME, 'a')
|
||||
out.write(force_str("".join(lines)))
|
||||
# Write a newline at the start, in case there was no newline at
|
||||
# the end of the file due to human editing.
|
||||
out.write("\n" + force_str("".join(lines)))
|
||||
out.close()
|
||||
|
||||
print("Generated new secrets in %s." % (OUTPUT_SETTINGS_FILENAME,))
|
||||
|
||||
Reference in New Issue
Block a user