mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-17 03:09:40 +08:00
Restore Backups: Fix handling the (re)downloaded tempfile.
Was opening the tempfile for handling when it was still open for writing. Also the wrong net-reply got used (reply instead of msg). part of CURA-12156
This commit is contained in:
parent
1f4f432d49
commit
43d9e1d522
@ -140,14 +140,15 @@ class RestoreBackupJob(Job):
|
||||
del to_install[package_id]
|
||||
|
||||
try:
|
||||
with NamedTemporaryFile(mode="wb+", suffix=".curapackage") as temp_file:
|
||||
bytes_read = reply.read(self.DISK_WRITE_BUFFER_SIZE)
|
||||
with NamedTemporaryFile(mode="wb", suffix=".curapackage", delete=False) as temp_file:
|
||||
bytes_read = msg.read(self.DISK_WRITE_BUFFER_SIZE)
|
||||
while bytes_read:
|
||||
temp_file.write(bytes_read)
|
||||
bytes_read = reply.read(self.DISK_WRITE_BUFFER_SIZE)
|
||||
bytes_read = msg.read(self.DISK_WRITE_BUFFER_SIZE)
|
||||
CuraApplication.getInstance().processEvents()
|
||||
if not CuraApplication.getInstance().getPackageManager().installPackage(temp_file.name):
|
||||
redownload_errors.append(f"Couldn't install package '{package_id}'.")
|
||||
temp_file.close()
|
||||
if not CuraApplication.getInstance().getPackageManager().installPackage(temp_file.name):
|
||||
redownload_errors.append(f"Couldn't install package '{package_id}'.")
|
||||
except IOError as ex:
|
||||
redownload_errors.append(f"Couldn't process package '{package_id}' because '{ex}'.")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user