-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Fix airflowctl auth login failing with trailing slash in api-url#61245
Fix airflowctl auth login failing with trailing slash in api-url#61245bugraoz93 merged 1 commit intoapache:mainfrom
Conversation
Description
closes: #61244
Fixes an authentication failure triggered when airflowctl auth login --api-url is 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?
- Yes (please specify the tool below)
- Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
- For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
- When adding dependency, check compliance with the ASF 3rd Party License Policy.
- For significant user-facing changes create newsfragment:
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.
|
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
Prab-27
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM !!
|
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! |