Fix airflowctl auth login failing with trailing slash in api-url#61245
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
89eedab to
c52ded9
Compare
|
Thanks @emin-ozata !! The URL Pattern mentioned in the doc This is helpful, since one could easily include it by mistake. cc : @bugraoz93 - Could you please share your insight on this when you have some time ? |
Agree, indeed, copy & paste from browsers can cause it, or similar. It makes sense! |
|
Let's see the CI, and then we can merge it. Thanks @emin-ozata! |
c52ded9 to
c2577b6
Compare
|
I added for you, but if you add |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
|
Congrats @emin-ozata! 🎉 |
Description
closes: #61244
Fixes an authentication failure triggered when
airflowctl auth login --api-urlis given a base URL with a trailing slash.Problem
When users copy the Airflow base URL from their browser's address bar (which typically includes a trailing slash), the
_get_base_url()method concatenates it directly with path segments, creating malformed URLs with double slashes (e.g.,
http://localhost:8080//auth),resulting in "Method Not Allowed" errors.
Solution
Normalize the base URL by stripping trailing slashes before constructing endpoint paths using
rstrip("/")in the_get_base_url()method.
Testing
Added test cases to verify URLs with trailing slashes are handled correctly for both CLI and AUTH client kinds.
Related Issues
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.