From 71937bf828f3e20fde7cf70658cc8fe66ec15d14 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 20 Jul 2021 17:58:29 +0200 Subject: [PATCH] DL: Align with online backend on allowed characters. CURA-8395 --- .../DigitalLibrary/resources/qml/CreateNewProjectPopup.qml | 4 ++-- .../DigitalLibrary/resources/qml/SaveProjectFilesPage.qml | 4 ++-- plugins/DigitalLibrary/src/DigitalFactoryApiClient.py | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml b/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml index 75fb8d5811..a7297c12fb 100644 --- a/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml +++ b/plugins/DigitalLibrary/resources/qml/CreateNewProjectPopup.qml @@ -93,7 +93,7 @@ Popup } validator: RegExpValidator { - regExp: /^[^\\\/\*\?\|\[\]]{0,96}$/ + regExp: /^[^\\\/\*\?\|\[\]]{0,99}$/ } text: PrintInformation.jobName @@ -148,7 +148,7 @@ Popup anchors.bottom: parent.bottom anchors.right: parent.right text: "Create" - enabled: newProjectNameTextField.text != "" && !busy + enabled: newProjectNameTextField.text.length >= 2 && !busy onClicked: { diff --git a/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml b/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml index 03bd655957..6b9361a900 100644 --- a/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml +++ b/plugins/DigitalLibrary/resources/qml/SaveProjectFilesPage.qml @@ -63,7 +63,7 @@ Item anchors.topMargin: UM.Theme.getSize("thin_margin").height validator: RegExpValidator { - regExp: /^[^\\\/\*\?\|\[\]]{0,96}$/ + regExp: /^[\w\-\. ()]{0,255}$/ } text: PrintInformation.jobName @@ -200,7 +200,7 @@ Item anchors.bottom: parent.bottom anchors.right: parent.right text: "Save" - enabled: (asProjectCheckbox.checked || asSlicedCheckbox.checked) && dfFilenameTextfield.text != "" + enabled: (asProjectCheckbox.checked || asSlicedCheckbox.checked) && dfFilenameTextfield.text.length >= 3 onClicked: { diff --git a/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py b/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py index a9a1ab360b..ad87ea9b8a 100644 --- a/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py +++ b/plugins/DigitalLibrary/src/DigitalFactoryApiClient.py @@ -365,12 +365,10 @@ class DigitalFactoryApiClient: :param on_finished: The function to be called after the result is parsed. :param on_error: The function to be called if anything goes wrong. """ - - display_name = re.sub(r"^[\\w\\-\\. ()]+\\.[a-zA-Z0-9]+$", " ", project_name) - Logger.log("i", "Attempt to create new DF project '{}'.".format(display_name)) + Logger.log("i", "Attempt to create new DF project '{}'.".format(project_name)) url = "{}/projects".format(self.CURA_API_ROOT) - data = json.dumps({"data": {"display_name": display_name}}).encode() + data = json.dumps({"data": {"display_name": project_name}}).encode() self._http.put(url, scope = self._scope, data = data,