From 042fd29e932cde6237cf6e81f50f9790afe08594 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Wed, 18 Mar 2026 17:28:05 +0100 Subject: [PATCH] Handle case-insensitive URI schemes in host normalization URI schemes are case-insensitive per RFC 3986, so HTTP:// and HTTPS:// must also be recognized when checking for existing schemes. Signed-off-by: Bryan Frimin --- pkg/cli/config/config.go | 3 ++- pkg/cmd/browse/browse.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/cli/config/config.go b/pkg/cli/config/config.go index 3c1fbeb29..59b421663 100644 --- a/pkg/cli/config/config.go +++ b/pkg/cli/config/config.go @@ -185,7 +185,8 @@ func (c *Config) Save() error { } func normalizeHost(host string) string { - if strings.HasPrefix(host, "http://") || strings.HasPrefix(host, "https://") { + lower := strings.ToLower(host) + if strings.HasPrefix(lower, "http://") || strings.HasPrefix(lower, "https://") { if u, err := url.Parse(host); err == nil { return u.Host } diff --git a/pkg/cmd/browse/browse.go b/pkg/cmd/browse/browse.go index f70f6ef5b..778663d42 100644 --- a/pkg/cmd/browse/browse.go +++ b/pkg/cmd/browse/browse.go @@ -58,7 +58,8 @@ func NewCmdBrowse(f *cmdutil.Factory) *cobra.Command { flagOrg = hc.Organization } - if !strings.HasPrefix(host, "http://") && !strings.HasPrefix(host, "https://") { + lowerHost := strings.ToLower(host) + if !strings.HasPrefix(lowerHost, "http://") && !strings.HasPrefix(lowerHost, "https://") { host = "https://" + host }