update_manager: attempt client archive download before removing old client files

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-03-03 16:55:38 -05:00
parent d9edcd9396
commit 1f9d896e17
1 changed files with 2 additions and 2 deletions

View File

@ -937,6 +937,8 @@ class WebUpdater:
if self.version == self.remote_version:
# Already up to date
return
self.notify_update_response(f"Downloading Client: {self.name}")
archive = await self.umgr.http_download_request(self.dl_url)
with tempfile.TemporaryDirectory(
suffix=self.name, prefix="client") as tempdir:
if os.path.isdir(self.path):
@ -949,8 +951,6 @@ class WebUpdater:
shutil.move(src_path, dest_dir)
shutil.rmtree(self.path)
os.mkdir(self.path)
self.notify_update_response(f"Downloading Client: {self.name}")
archive = await self.umgr.http_download_request(self.dl_url)
with zipfile.ZipFile(io.BytesIO(archive)) as zf:
zf.extractall(self.path)
# Move temporary files back into