diff --git a/airflow/www/views.py b/airflow/www/views.py index 74ff10bed2080..f2ea54e81ae55 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -1944,7 +1944,7 @@ def delete(self): @provide_session def trigger(self, dag_id: str, session: Session = NEW_SESSION): """Triggers DAG Run.""" - run_id = request.values.get("run_id", "").replace(" ", "+") + run_id = request.values.get("run_id", "") origin = get_safe_url(request.values.get("origin")) unpause = request.values.get("unpause") request_conf = request.values.get("conf") diff --git a/tests/www/views/test_views_trigger_dag.py b/tests/www/views/test_views_trigger_dag.py index 6471c092bd5f9..7e89d29f5b7e1 100644 --- a/tests/www/views/test_views_trigger_dag.py +++ b/tests/www/views/test_views_trigger_dag.py @@ -19,6 +19,7 @@ import datetime import json +from urllib.parse import quote import pytest @@ -369,6 +370,7 @@ def test_trigger_dag_params_array_value_none_render(admin_client, dag_maker, ses def test_dag_run_id_pattern(session, admin_client, pattern, run_id, result): with conf_vars({("scheduler", "allowed_run_id_pattern"): pattern}): test_dag_id = "example_bash_operator" + run_id = quote(run_id) admin_client.post(f"dags/{test_dag_id}/trigger?run_id={run_id}", data={"conf": "{}"}) run = session.query(DagRun).filter(DagRun.dag_id == test_dag_id).first() if result: