From 8c12e26951f4b1610613a552d847bbb1dc2afbff Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 3 Nov 2025 02:17:36 +0100 Subject: [PATCH] Fix Files accidentally overwriting or deleting files --- pasch/modules/files.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pasch/modules/files.py b/pasch/modules/files.py index 7480d5a..d53aa95 100644 --- a/pasch/modules/files.py +++ b/pasch/modules/files.py @@ -128,6 +128,7 @@ class Files(Module): if reason := self._file_db.verify_hash(path, cur_hash): self.c.print(f"[red]Error:[/] {escape(reason)}") + return # We want to avoid scenarios where we fail to remember a file we've # written. It is better to remember a file with an incorrect hash than @@ -143,6 +144,7 @@ class Files(Module): cur_hash = hash_file(path) if reason := self._file_db.verify_hash(path, cur_hash): self.c.print(f"[red]Error:[/] {escape(reason)}") + return try: path.unlink()