Safe disk write for content.json files
This commit is contained in:
parent
c94e73a029
commit
d9f8e83429
1 changed files with 5 additions and 2 deletions
|
@ -166,8 +166,11 @@ class SiteStorage(object):
|
||||||
with open(file_path, "wb") as file:
|
with open(file_path, "wb") as file:
|
||||||
shutil.copyfileobj(content, file) # Write buff to disk
|
shutil.copyfileobj(content, file) # Write buff to disk
|
||||||
else: # Simple string
|
else: # Simple string
|
||||||
with open(file_path, "wb") as file:
|
if inner_path == "content.json" and os.path.isfile(file_path):
|
||||||
file.write(content)
|
helper.atomicWrite(file_path, content)
|
||||||
|
else:
|
||||||
|
with open(file_path, "wb") as file:
|
||||||
|
file.write(content)
|
||||||
del content
|
del content
|
||||||
self.onUpdated(inner_path)
|
self.onUpdated(inner_path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue