mirror of
https://github.com/grdl/git-get.git
synced 2026-02-04 22:39:41 +00:00
Use the configured default host when host is empty after parsing the URL
This commit is contained in:
@@ -43,13 +43,16 @@ func ParseURL(rawURL string) (url *urlpkg.URL, err error) {
|
||||
url.User = urlpkg.User("git")
|
||||
}
|
||||
|
||||
// Default to https
|
||||
// Default to configured defaultHost when host is empty
|
||||
if url.Host == "" {
|
||||
url.Host = Cfg.DefaultHost()
|
||||
}
|
||||
|
||||
// Default to https when scheme is empty
|
||||
if url.Scheme == "" {
|
||||
url.Scheme = "https"
|
||||
}
|
||||
|
||||
// TODO: Default to github host
|
||||
|
||||
return url, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ func TestURLParse(t *testing.T) {
|
||||
{"ftp://github.com/grdl/git-get.git", "github.com/grdl/git-get"},
|
||||
{"ftps://github.com/grdl/git-get.git", "github.com/grdl/git-get"},
|
||||
{"rsync://github.com/grdl/git-get.git", "github.com/grdl/git-get"},
|
||||
{"local/grdl/git-get/", "local/grdl/git-get"},
|
||||
{"local/grdl/git-get/", "github.com/local/grdl/git-get"},
|
||||
{"file://local/grdl/git-get", "local/grdl/git-get"},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user