From adb5f28aaf4d2170acbddadcf002eb7bfd052d82 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 14 Apr 2021 16:56:17 +0200 Subject: [PATCH] Filter out disallowed characters from job name Took a while to figure out exactly what to do here. But the task itself is simple. The Ultimaker software apparently doesn't accept special characters here. The regex here is exactly the inverse of the regex that they use to accept job names. Done as a 5 minute fix. --- plugins/UM3NetworkPrinting/src/ExportFileJob.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/UM3NetworkPrinting/src/ExportFileJob.py b/plugins/UM3NetworkPrinting/src/ExportFileJob.py index 12f5a28877..953b167a6e 100644 --- a/plugins/UM3NetworkPrinting/src/ExportFileJob.py +++ b/plugins/UM3NetworkPrinting/src/ExportFileJob.py @@ -1,6 +1,7 @@ # Copyright (c) 2021 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import re # Filtering out invalid characters. from typing import List, Optional from UM.FileHandler.FileHandler import FileHandler @@ -27,6 +28,7 @@ class ExportFileJob(WriteFileJob): # Determine the filename. job_name = CuraApplication.getInstance().getPrintInformation().jobName + job_name = re.sub("[^\w\-. ()]", "-", job_name) extension = self._mesh_format_handler.preferred_format.get("extension", "") self.setFileName("{}.{}".format(job_name, extension))