summaryrefslogtreecommitdiff
path: root/backend/helpers.py
diff options
context:
space:
mode:
authorAAGaming <aa@mail.catvibers.me>2022-11-15 16:44:24 -0500
committerGitHub <noreply@github.com>2022-11-15 13:44:24 -0800
commit50764600c83b2bdec599a9fd8e27b3c10a2afd96 (patch)
treef802b7c438723846971162d0c845caa237e0cb7d /backend/helpers.py
parentaec70631393ba307f1ca493a4d96f244e1439555 (diff)
downloaddecky-loader-50764600c83b2bdec599a9fd8e27b3c10a2afd96.tar.gz
decky-loader-50764600c83b2bdec599a9fd8e27b3c10a2afd96.zip
Refactoring in preparation for WebSockets (#254)v2.4.1-pre2
* Fix injector race conditions * add some more tasks * hide useless rollup warnings * goodbye to clientsession errors * completely fix desktop mode switch race condition * fix typos and TS warning in plugin error handler * fix chown error * start debugger if needed and not already started * fix get_steam_resource for the like 2 legacy plugins still using it lol * add ClientOSError to get_tabs error handling
Diffstat (limited to 'backend/helpers.py')
-rw-r--r--backend/helpers.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/backend/helpers.py b/backend/helpers.py
index 0b6e7746..c12a2fa5 100644
--- a/backend/helpers.py
+++ b/backend/helpers.py
@@ -94,18 +94,18 @@ async def download_remote_binary_to_path(url, binHash, path) -> bool:
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
- else:
- raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}")
+ 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
else:
- rv = False
+ raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}")
+ else:
+ rv = False
except:
rv = False