Support www.github.com git remote URLs
This commit is contained in:
parent
c17251d106
commit
303f60815f
2 changed files with 7 additions and 1 deletions
|
|
@ -33,7 +33,7 @@ func FromFullName(nwo string) Interface {
|
|||
}
|
||||
|
||||
func FromURL(u *url.URL) (Interface, error) {
|
||||
if !strings.EqualFold(u.Hostname(), defaultHostname) {
|
||||
if !strings.EqualFold(u.Hostname(), defaultHostname) && !strings.EqualFold(u.Hostname(), "www."+defaultHostname) {
|
||||
return nil, fmt.Errorf("unsupported hostname: %s", u.Hostname())
|
||||
}
|
||||
parts := strings.SplitN(strings.TrimPrefix(u.Path, "/"), "/", 3)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@ func Test_repoFromURL(t *testing.T) {
|
|||
result: "monalisa/octo-cat",
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
name: "www.github.com URL",
|
||||
input: "http://www.GITHUB.com/monalisa/octo-cat.git",
|
||||
result: "monalisa/octo-cat",
|
||||
err: nil,
|
||||
},
|
||||
{
|
||||
name: "unsupported hostname",
|
||||
input: "https://example.com/one/two",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue