diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index cafc18858f..0960d89076 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -2,9 +2,11 @@ from UM.Workspace.WorkspaceWriter import WorkspaceWriter from UM.Application import Application from UM.Preferences import Preferences from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.ContainerStack import ContainerStack from cura.Settings.ExtruderManager import ExtruderManager import zipfile from io import StringIO +import copy class ThreeMFWorkspaceWriter(WorkspaceWriter): @@ -74,5 +76,14 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): file_in_archive = zipfile.ZipInfo(file_name) # For some reason we have to set the compress type of each file as well (it doesn't keep the type of the entire archive) file_in_archive.compress_type = zipfile.ZIP_DEFLATED + if type(container) == ContainerStack and (container.getMetaDataEntry("network_authentication_id") or container.getMetaDataEntry("network_authentication_key")): + # TODO: Hack + # Create a shallow copy of the container, so we can filter out the network auth (if any) + container_copy = copy.deepcopy(container) + container_copy.removeMetaDataEntry("network_authentication_id") + container_copy.removeMetaDataEntry("network_authentication_key") + serialized_data = container_copy.serialize() + else: + serialized_data = container.serialize() - archive.writestr(file_in_archive, container.serialize()) + archive.writestr(file_in_archive, serialized_data)