mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06: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
1 changed files with 2 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue