tldts icon indicating copy to clipboard operation
tldts copied to clipboard

`isIcann` returns true or false when there's no valid extension

Open seahindeniz opened this issue 6 months ago • 3 comments

parse('https://google.');

// returns
{
    "domain": null,
    "domainWithoutSuffix": null,
    "hostname": "google",
    "isIcann": true, // incorrect
    "isIp": false,
    "isPrivate": false,
    "publicSuffix": "google",
    "subdomain": null
}
parse('https://googles.');

// returns
{
    "domain": null,
    "domainWithoutSuffix": null,
    "hostname": "googles",
    "isIcann": false, // correct
    "isIp": false,
    "isPrivate": false,
    "publicSuffix": "googles",
    "subdomain": null
}

"tldts": "7.0.9",

seahindeniz avatar Jun 26 '25 15:06 seahindeniz

Hi @seahindeniz, google is a valid public suffix: https://github.com/publicsuffix/list/blob/9ae55199aa39694b19b7791d2e7b0b7592b3bdd7/public_suffix_list.dat#L8388

So I think the output above is correct.

remusao avatar Jun 27 '25 06:06 remusao

I see but google is not actually a suffix in this context 🤔 I'm not sure if it parsed correctly to be evaluated as suffix

seahindeniz avatar Jun 27 '25 06:06 seahindeniz

It is, a domain can end with a . so https://google. is interpreted as a domain wit has single label (google) which happens to be a valid public suffix.

remusao avatar Jun 27 '25 08:06 remusao