From 303f60815f72f9fc1b7d449eb3dbf503c89d9ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 27 Mar 2020 13:55:16 +0100 Subject: [PATCH] Support `www.github.com` git remote URLs --- internal/ghrepo/repo.go | 2 +- internal/ghrepo/repo_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/ghrepo/repo.go b/internal/ghrepo/repo.go index f683d9249..fe3a0eba7 100644 --- a/internal/ghrepo/repo.go +++ b/internal/ghrepo/repo.go @@ -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) diff --git a/internal/ghrepo/repo_test.go b/internal/ghrepo/repo_test.go index cc0f231b8..fef04fb8c 100644 --- a/internal/ghrepo/repo_test.go +++ b/internal/ghrepo/repo_test.go @@ -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",