Loading
fix(git): recognize uppercase URL schemes when parsing remotes
What does this MR do and why?
git.ParseURL misparses a remote URL whose scheme is uppercase. The protocol
checks only match lowercase prefixes:
func isSupportedProtocol(u string) bool {
return strings.HasPrefix(u, "ssh:") || ... || strings.HasPrefix(u, "https:")
}HasPrefix("HTTPS://...", "https:") is false, so ParseURL falls through to
its scp-style SSH transform:
HTTPS://example.com/owner/repo.git => scheme="ssh" host="HTTPS" path="///example.com/owner/repo.git"URL schemes are case-insensitive (RFC 3986), and net/url.Parse already
lowercases the scheme; only glab's pre-check was case-sensitive. The checks now
compare in lower case, so an uppercase scheme parses the same as the lowercase
form.
Test coverage
An uppercase HTTPS scheme case added to TestParseURL, expecting
scheme="https", host="example.com". It fails on the old code
(host="HTTPS"). The existing scheme cases are unchanged.
go test ./internal/git/ is green.
Related issues
Closes #8435 (closed)