From 4cfce3ea8181041772a52a565519cab5749a5fd1 Mon Sep 17 00:00:00 2001 From: arenekosreal <17194552+arenekosreal@users.noreply.github.com> Date: Fri, 20 Sep 2024 22:14:17 +0800 Subject: [PATCH] Handle situation when no sha256 is provided. --- src/crx_repo/client.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/crx_repo/client.py b/src/crx_repo/client.py index f91482d..f3b4fa0 100644 --- a/src/crx_repo/client.py +++ b/src/crx_repo/client.py @@ -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(