ashb commented on code in PR #54218:
URL: https://github.com/apache/airflow/pull/54218#discussion_r2269387382
##########
airflow-core/src/airflow/utils/helpers.py:
##########
@@ -204,7 +203,7 @@ def build_airflow_dagrun_url(dag_id: str, run_id: str) ->
str:
http://localhost:8080/dags/hi/runs/manual__2025-02-23T18:27:39.051358+00:00_RZa1at4Q
"""
baseurl = conf.get("api", "base_url", fallback="/")
- return urljoin(baseurl, f"dags/{dag_id}/runs/{run_id}")
+ return f"{baseurl.rstrip('/')}/dags/{dag_id}/runs/{run_id}")
Review Comment:
urljoin is a better tool for this job, as @tirkarthi said.
```
>>> urljoin("http://example.com/d123", "dags/foo")
'http://example.com/dags/foo'
>>> urljoin("http://example.com/d123/", "dags/foo")
'http://example.com/d123/dags/foo'
>>> urljoin("http://example.com/d123//", "dags/foo")
'http://example.com/d123/dags/foo'
```
So either we should ensure baseurl has a trailing slash (not here, but
earlier on, likely in settings.py) or
```suggestion
return urljoin(baseurl + "/", "dags/{dag_id}/runs/{run_id}")
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]