Catch errors for corrupted zip files when reading project files

Fixes Sentry issue CURA-1DG.
This commit is contained in:
Ghostkeeper 2020-11-18 01:57:49 +01:00
parent 1cd5757029
commit eeecd545db
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -636,6 +636,13 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
message.show()
self.setWorkspaceName("")
return [], {}
except zipfile.BadZipFile as e:
message = Message(i18n_catalog.i18nc("@info:error Don't translate the XML tags <filename> or <message>!",
"Project file <filename>{0}</filename> is corrupt: <message>{1}</message>.", file_name, str(e)),
title = i18n_catalog.i18nc("@info:title", "Can't Open Project File"))
message.show()
self.setWorkspaceName("")
return [], {}
cura_file_names = [name for name in archive.namelist() if name.startswith("Cura/")]