diff --git a/darkseid/comicarchive.py b/darkseid/comicarchive.py index 2284234..978dc78 100644 --- a/darkseid/comicarchive.py +++ b/darkseid/comicarchive.py @@ -175,6 +175,9 @@ def copy_from_archive(self, other_archive: UnknownArchiver) -> bool: zout.writestr(filename, data) return True except Exception as e: + # Remove any partial files created + if self.path.exists(): + self.path.unlink() logger.warning(f"Error while copying to {self.path}: {e}") return False @@ -255,6 +258,9 @@ def copy_from_archive(self, other_archive: UnknownArchiver) -> bool: zout.writestr(data, fname) return True except Exception as e: + # Remove any partial files created + if self.path.exists(): + self.path.unlink() logger.warning(f"Error while copying to {self.path}: {e}") return False