mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Authentication data is now stripped from project file before saving
CURA-1263
This commit is contained in:
parent
8f023524d2
commit
16447f7173
1 changed files with 12 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue