Skip to content

Commit

Permalink
Handle situation when no sha256 is provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
arenekosreal committed Sep 20, 2024
1 parent 6314670 commit 4cfce3e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/crx_repo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,20 @@ async def _do_download(self):
_logger.error("Failed to build because async operation timeout.")
_logger.debug("Checking checksums of extension %s...", self.extension_id)
sha256_hash = hash_calculator.hexdigest()
if sha256_hash != update.sha256:
if update.sha256 is not None and sha256_hash != update.sha256:
_logger.error(
"SHA256 checksum of %s mismatch. Removing file.",
self.extension_id,
)
extension_path.unlink()
else:
_logger.info(
"SHA256 checksum of %s match. Keeping file.",
self.extension_id,
)
if update.sha256 is None:
_logger.warning("No sha256 is provied for this extension file, still keeping file.")
else:
_logger.info(
"SHA256 checksum of %s match. Keeping file.",
self.extension_id,
)
_ = extension_path.rename(extension_path.parent / extension_path.stem)

async def _check_update(
Expand Down

0 comments on commit 4cfce3e

Please sign in to comment.