Skip to content

Commit

Permalink
Fix settings file storage at first/clean startup (#1023)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt authored Dec 31, 2024
1 parent f3b3f10 commit a15a8f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion matter_server/server/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ async def async_save(self) -> None:
def do_save() -> None:
# make backup before we write a new file
self.filename_backup.unlink(True)
shutil.copy(self.filename, self.filename_backup)
if self.filename.is_file():
shutil.copy(self.filename, self.filename_backup)

# use atomomic write to avoid corrupting the file
# if power is cut during write, we don't write a corrupted file
Expand Down

0 comments on commit a15a8f1

Please sign in to comment.