This is an automated email from the ASF dual-hosted git repository.
bugraoz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new dace2474ad9 Strip api-url for airflowctl auth login which is failing
with trailing slash (#61245)
dace2474ad9 is described below
commit dace2474ad9f912747c7a4b23e259b8f0201ebc6
Author: Emin Özata <[email protected]>
AuthorDate: Fri Jan 30 21:13:12 2026 +0300
Strip api-url for airflowctl auth login which is failing with trailing
slash (#61245)
---
airflow-ctl/src/airflowctl/api/client.py | 1 +
airflow-ctl/tests/airflow_ctl/api/test_client.py | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/airflow-ctl/src/airflowctl/api/client.py
b/airflow-ctl/src/airflowctl/api/client.py
index 5a719cac164..579d78ef0aa 100644
--- a/airflow-ctl/src/airflowctl/api/client.py
+++ b/airflow-ctl/src/airflowctl/api/client.py
@@ -226,6 +226,7 @@ class Client(httpx.Client):
cls, base_url: str, kind: Literal[ClientKind.AUTH, ClientKind.CLI] =
ClientKind.CLI
) -> str:
"""Get the base URL of the client."""
+ base_url = base_url.rstrip("/")
if kind == ClientKind.AUTH:
return f"{base_url}/auth"
return f"{base_url}/api/v2"
diff --git a/airflow-ctl/tests/airflow_ctl/api/test_client.py
b/airflow-ctl/tests/airflow_ctl/api/test_client.py
index 39ffc436706..5913009ecd4 100644
--- a/airflow-ctl/tests/airflow_ctl/api/test_client.py
+++ b/airflow-ctl/tests/airflow_ctl/api/test_client.py
@@ -93,6 +93,10 @@ class TestClient:
("http://localhost:8080", ClientKind.AUTH,
"http://localhost:8080/auth/"),
("https://example.com", ClientKind.CLI,
"https://example.com/api/v2/"),
("https://example.com", ClientKind.AUTH,
"https://example.com/auth/"),
+ ("http://localhost:8080/", ClientKind.CLI,
"http://localhost:8080/api/v2/"),
+ ("http://localhost:8080/", ClientKind.AUTH,
"http://localhost:8080/auth/"),
+ ("https://example.com/", ClientKind.CLI,
"https://example.com/api/v2/"),
+ ("https://example.com/", ClientKind.AUTH,
"https://example.com/auth/"),
],
)
def test_refresh_base_url(self, base_url, client_kind, expected_base_url):