From 9f27e7861f6c6b5fc53d96ee37434d50b1ba042c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 16 Nov 2016 16:04:03 +0100 Subject: [PATCH] Workspace reader now does a pre-check to see if it's a workspace in the first place CURA-1263 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 04fc21b54a..060617875d 100644 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -99,6 +99,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader): if quality_changes[0] != instance_container: quality_changes_conflict = True break + try: + archive.open("Cura/preferences.cfg") + except KeyError: + # If there is no preferences file, it's not a workspace, so notify user of failure. + Logger.log("w", "File %s is not a valid workspace.", file_name) + return WorkspaceReader.PreReadResult.failed if machine_conflict or quality_changes_conflict or material_conflict: # There is a conflict; User should choose to either update the existing data, add everything as new data or abort