mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 10:17:52 -06:00
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.
This commit is contained in:
parent
db74bbda60
commit
adb5f28aaf
1 changed files with 2 additions and 0 deletions
|
@ -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))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue