Validate Host URL on Login by YannickAlex07 · Pull Request #31986 · helm/helm
What this PR does / why we need it:
This PR adds host validation on login to check if a scheme or path is present. If yes, the login is cancelled with a dedicated error message, informing the user what went wrong.
The context of this PR is the issue #31962, where we discussed the handling of the URL scheme in Helm v4 and the change from v3 (also refer to #30873). Currently, providing a scheme does raise a non-specific error, therefore the goal of this change is to provide clearer error messages and halt execution early (even if ORAS would technically also catch these errors later down the line). Providing a path did already produce a warning, however I decided to remove the warning and integrate the check into the new validation.
Validation is implemented using a naive regex to check if any scheme or path is present, as built-in things like url.Parse don't behave well when no scheme is present, interpreting the entire host as a path.
Closes #31962
Special notes for your reviewer:
If applicable:
- this PR contains user facing changes (the
docs neededlabel should be applied if so) - this PR contains unit tests
- this PR has been tested for backwards compatibility