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 <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-03-18 17:28:05 +01:00
parent 0f1fc2f069
commit 042fd29e93
2 changed files with 4 additions and 2 deletions

View File

@@ -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
}

View File

@@ -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
}