Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions airflow/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
Tuple,
TypeVar,
)
from urllib import parse

from airflow.configuration import conf
from airflow.exceptions import AirflowException
Expand Down Expand Up @@ -258,8 +257,7 @@ def build_airflow_url_with_query(query: Dict[str, Any]) -> str:
import flask

view = conf.get('webserver', 'dag_default_view').lower()
url = flask.url_for(f"Airflow.{view}")
return f"{url}?{parse.urlencode(query)}"
return flask.url_for(f"Airflow.{view}", **query)
Copy link
Member Author

@ashb ashb Feb 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out url_for handles url prams and everything else gets set as query params, so the fix was easy :)



# The 'template' argument is typed as Any because the jinja2.Template is too
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_build_airflow_url_with_query(self):
Test query generated with dag_id and params
"""
query = {"dag_id": "test_dag", "param": "key/to.encode"}
expected_url = "/graph?dag_id=test_dag&param=key%2Fto.encode"
expected_url = "/dags/test_dag/graph?param=key%2Fto.encode"

from airflow.www.app import cached_app

Expand Down