mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-19 04:09:40 +08:00
Restore Backups: Correctly handle requests to redownload plugins.
- Fix: Need to fill the package's API version into the (template) URL, instead of using latest. - Fix: Loop was closing over the package ID, which caused the recieving function to always only get the last handled package ID instead of the one it needed to handle. part of CURA-12156
This commit is contained in:
parent
43d9e1d522
commit
1fb89e0e7d
@ -22,7 +22,7 @@ from cura.CuraApplication import CuraApplication
|
||||
from cura.UltimakerCloud.UltimakerCloudScope import UltimakerCloudScope
|
||||
import cura.UltimakerCloud.UltimakerCloudConstants as UltimakerCloudConstants
|
||||
|
||||
PACKAGES_URL = f"{UltimakerCloudConstants.CuraCloudAPIRoot}/cura-packages/v{UltimakerCloudConstants.CuraCloudAPIVersion}/cura/v{CuraSDKVersion}/packages"
|
||||
PACKAGES_URL_TEMPLATE = f"{UltimakerCloudConstants.CuraCloudAPIRoot}/cura-packages/v{UltimakerCloudConstants.CuraCloudAPIVersion}/cura/v{{0}}/packages/{{1}}/download"
|
||||
|
||||
class RestoreBackupJob(Job):
|
||||
"""Downloads a backup and overwrites local configuration with the backup.
|
||||
@ -163,13 +163,15 @@ class RestoreBackupJob(Job):
|
||||
self._job_done.set()
|
||||
|
||||
self._package_download_scope = UltimakerCloudScope(CuraApplication.getInstance())
|
||||
for package_id in to_install:
|
||||
for package_id, package_api_version in to_install.items():
|
||||
def handlePackageId(package_id: str = package_id):
|
||||
HttpRequestManager.getInstance().get(
|
||||
f"{PACKAGES_URL}/{package_id}/download",
|
||||
PACKAGES_URL_TEMPLATE.format(package_api_version, package_id),
|
||||
scope=self._package_download_scope,
|
||||
callback=lambda msg: packageDownloadCallback(package_id, msg),
|
||||
error_callback=lambda msg, err: packageDownloadCallback(package_id, msg, err)
|
||||
)
|
||||
handlePackageId(package_id)
|
||||
|
||||
@staticmethod
|
||||
def _verifyMd5Hash(file_path: str, known_hash: str) -> bool:
|
||||
|
Loading…
x
Reference in New Issue
Block a user