Safe disk write for content.json files

This commit is contained in:
shortcutme 2017-01-05 02:26:44 +01:00
parent c94e73a029
commit d9f8e83429

View file

@ -166,6 +166,9 @@ class SiteStorage(object):
with open(file_path, "wb") as file:
shutil.copyfileobj(content, file) # Write buff to disk
else: # Simple string
if inner_path == "content.json" and os.path.isfile(file_path):
helper.atomicWrite(file_path, content)
else:
with open(file_path, "wb") as file:
file.write(content)
del content