mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 14:34:01 -06: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
1 changed files with 6 additions and 5 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue