Skip to content

Commit c1dd1c7

Browse files
committed
White-space formatting is one of the most incomprehensible decisions...
1 parent 310dd70 commit c1dd1c7

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

backend/decky_loader/helpers.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,20 @@ async def download_remote_binary_to_path(url: str, binHash: str, path: str) -> b
112112
if os.access(os.path.dirname(path), os.W_OK):
113113
async with ClientSession() as client:
114114
res = await client.get(url, ssl=get_ssl_context())
115-
if res.status == 200:
116-
data = BytesIO(await res.read())
117-
remoteHash = sha256(data.getbuffer()).hexdigest()
118-
if binHash == remoteHash:
119-
data.seek(0)
120-
with open(path, 'wb') as f:
121-
f.write(data.getbuffer())
122-
rv = True
115+
if res.status == 200:
116+
logger.debug("Download attempt of URL: " + url)
117+
data = await res.read()
118+
remoteHash = sha256(data).hexdigest()
119+
if binHash == remoteHash:
120+
with open(path, 'wb') as f:
121+
f.write(data)
122+
rv = True
123+
else:
124+
raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}")
123125
else:
124-
raise Exception(f"Fatal Error: Hash Mismatch for remote binary {path}@{url}")
125-
else:
126-
rv = False
127-
except:
126+
rv = False
127+
except Exception as e:
128+
logger.error("Error during download" + str(e))
128129
rv = False
129130

130131
return rv

0 commit comments

Comments
 (0)