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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user