Skip to content

Commit

Permalink
Remove any partially create archives
Browse files Browse the repository at this point in the history
  • Loading branch information
bpepple committed Jun 27, 2022
1 parent 04c4a99 commit d219a47
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions darkseid/comicarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit d219a47

Please sign in to comment.