diff options
Diffstat (limited to 'backend/decky_loader/helpers.py')
| -rw-r--r-- | backend/decky_loader/helpers.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/backend/decky_loader/helpers.py b/backend/decky_loader/helpers.py index 14572004..7789592f 100644 --- a/backend/decky_loader/helpers.py +++ b/backend/decky_loader/helpers.py @@ -112,19 +112,20 @@ async def download_remote_binary_to_path(url: str, binHash: str, path: str) -> b if os.access(os.path.dirname(path), os.W_OK): async with ClientSession() as client: res = await client.get(url, ssl=get_ssl_context()) - if res.status == 200: - data = BytesIO(await res.read()) - remoteHash = sha256(data.getbuffer()).hexdigest() - if binHash == remoteHash: - data.seek(0) - with open(path, 'wb') as f: - f.write(data.getbuffer()) - rv = True + if res.status == 200: + logger.debug("Download attempt of URL: " + url) + data = await res.read() + remoteHash = sha256(data).hexdigest() + if binHash == remoteHash: + with open(path, 'wb') as f: + f.write(data) + rv = True + else: + raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}") else: - raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}") - else: - rv = False - except: + rv = False + except Exception as e: + logger.error("Error during download" + str(e)) rv = False return rv |
