diff --git a/admyral/server/endpoints/workflow_endpoints.py b/admyral/server/endpoints/workflow_endpoints.py index b36e0283..46756981 100644 --- a/admyral/server/endpoints/workflow_endpoints.py +++ b/admyral/server/endpoints/workflow_endpoints.py @@ -22,6 +22,7 @@ MANUAL_TRIGGER_SOURCE_NAME = "manual" +SPACE = " " class WorkflowBody(BaseModel): @@ -61,6 +62,9 @@ async def push_workflow_impl( admyral_store = get_admyral_store() workers_client = get_workers_client() + if SPACE in workflow_name: + raise ValueError("Workflow name must not contain spaces.") + if workflow_id: existing_workflow = await admyral_store.get_workflow_by_id(workflow_id) else: diff --git a/web/src/components/save-workflow-button/save-workflow-button.tsx b/web/src/components/save-workflow-button/save-workflow-button.tsx index 974074c5..7f4c0235 100644 --- a/web/src/components/save-workflow-button/save-workflow-button.tsx +++ b/web/src/components/save-workflow-button/save-workflow-button.tsx @@ -8,6 +8,8 @@ import { useEffect } from "react"; import { errorToast, infoToast } from "@/lib/toast"; import { AxiosError } from "axios"; +const SPACE = " "; + export default function SaveWorkflowButton() { const { getWorkflow, updateWebhookIdAndSecret } = useWorkflowStore(); const saveWorkflow = useSaveWorkflowApi(); @@ -41,13 +43,16 @@ export default function SaveWorkflowButton() { const handleSaveWorkflow = () => { const workflow = getWorkflow(); - // TODO(frontend): validate workflow name if (workflow.workflowName.length === 0) { errorToast( "Workflow name must not be empty. Go to settings to set one.", ); return; } + if (workflow.workflowName.includes(SPACE)) { + errorToast("Workflow name must contain empty spaces."); + return; + } saveWorkflow.mutate(workflow); };