mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-13 09:03:20 +03: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):
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user