mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-17 16:57:50 +00:00
White-space formatting is one of the most incomprehensible decisions...
This commit is contained in:
@@ -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):
|
if os.access(os.path.dirname(path), os.W_OK):
|
||||||
async with ClientSession() as client:
|
async with ClientSession() as client:
|
||||||
res = await client.get(url, ssl=get_ssl_context())
|
res = await client.get(url, ssl=get_ssl_context())
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
data = BytesIO(await res.read())
|
logger.debug("Download attempt of URL: " + url)
|
||||||
remoteHash = sha256(data.getbuffer()).hexdigest()
|
data = await res.read()
|
||||||
if binHash == remoteHash:
|
remoteHash = sha256(data).hexdigest()
|
||||||
data.seek(0)
|
if binHash == remoteHash:
|
||||||
with open(path, 'wb') as f:
|
with open(path, 'wb') as f:
|
||||||
f.write(data.getbuffer())
|
f.write(data)
|
||||||
rv = True
|
rv = True
|
||||||
|
else:
|
||||||
|
raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}")
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}")
|
rv = False
|
||||||
else:
|
except Exception as e:
|
||||||
rv = False
|
logger.error("Error during download" + str(e))
|
||||||
except:
|
|
||||||
rv = False
|
rv = False
|
||||||
|
|
||||||
return rv
|
return rv
|
||||||
|
|||||||
Reference in New Issue
Block a user