mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Revert file mode write_json (#16897)
This commit is contained in:
parent
9ab8f78b19
commit
d0ddc28f96
@ -47,9 +47,7 @@ def save_json(filename: str, data: Union[List, Dict],
|
||||
"""
|
||||
try:
|
||||
json_data = json.dumps(data, sort_keys=True, indent=4)
|
||||
mode = 0o600 if private else 0o644
|
||||
with open(os.open(filename, os.O_WRONLY | os.O_CREAT, mode),
|
||||
'w', encoding='utf-8') as fdesc:
|
||||
with open(filename, 'w', encoding='utf-8') as fdesc:
|
||||
fdesc.write(json_data)
|
||||
except TypeError as error:
|
||||
_LOGGER.exception('Failed to serialize to JSON: %s',
|
||||
|
Loading…
x
Reference in New Issue
Block a user