diff --git a/parse.go b/parse.go index 3feca0d..a01d063 100644 --- a/parse.go +++ b/parse.go @@ -31,7 +31,12 @@ func Parse(s string) (*URL, error) { dom, port := domainPort(url.Host) //etld+1 etld1, err := publicsuffix.EffectiveTLDPlusOne(dom) - _, icann := publicsuffix.PublicSuffix(strings.ToLower(dom)) + suffix, icann := publicsuffix.PublicSuffix(strings.ToLower(dom)) + // HACK: attempt to support valid domains which are not registered with ICAN + if err != nil && !icann && suffix == dom { + etld1 = dom + err = nil + } if err != nil { return nil, err } diff --git a/parse_test.go b/parse_test.go index 38c18fd..afd6c13 100644 --- a/parse_test.go +++ b/parse_test.go @@ -46,3 +46,7 @@ func Test5(t *testing.T) { func Test6(t *testing.T) { run("https://google.Com", "", "google", "Com", true, t) } + +func Test7(t *testing.T) { + run("https://github.io", "", "github", "io", false, t) +}