Skip to content

Commit

Permalink
Fix loading existing xml
Browse files Browse the repository at this point in the history
  • Loading branch information
lordwelch committed Dec 25, 2023
1 parent fea2d71 commit 3af29df
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion comicinfoxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def get_metadata_string(self, archive: Archiver) -> str:

def set_metadata(self, metadata: GenericMetadata, archive: Archiver) -> bool:
if self.supports_metadata(archive):
return archive.write_file(self.file, self._bytes_from_metadata(metadata, archive.read_file(self.file)))
xml = b''
if self.has_metadata(archive):
xml = archive.read_file(self.file)
return archive.write_file(self.file, self._bytes_from_metadata(metadata, xml))
logger.warning('Archive (%s) does not support %s metadata', archive.name(), self.name())
return False

Expand Down

0 comments on commit 3af29df

Please sign in to comment.