mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 03:29:00 +08:00
Don't crash when importing definition files as materials
Reproduction steps: * In the Material Manager, click on 'Import material'. * Change the file type in the file dialogue to 'All files'. * Select any .def.json file, for example from Cura's own resources/definitions folder. Previously this crashed the application. Now it shows the user an error message instead. Fixes Sentry error CURA-D4.
This commit is contained in:
parent
485e37e7f5
commit
566af8be2e
@ -239,6 +239,8 @@ class ContainerManager(QObject):
|
||||
container_type = container_registry.getContainerForMimeType(mime_type)
|
||||
if not container_type:
|
||||
return {"status": "error", "message": "Could not find a container to handle the specified file."}
|
||||
if not issubclass(container_type, InstanceContainer):
|
||||
return {"status": "error", "message": "This is not a material container, but another type of file."}
|
||||
|
||||
container_id = urllib.parse.unquote_plus(mime_type.stripExtension(os.path.basename(file_url)))
|
||||
container_id = container_registry.uniqueName(container_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user