You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see here the eu.org belongs to the private domain section, so parsing a domain like example.eu.org should return org as the top-level domain, not the eu.org (I've mistaken these two concepts as well and opened a similar issue for a php package.)
Information
Description
Module version
7.0.1
Node version
16.17.0
OS Platform
Linux 5.19.0-76051900-generic
Standalone code, or another way to reproduce the problem
import { parseDomain, ParseResultType } from "parse-domain";
const parseResult = parseDomain(
// This should be a string with basic latin letters only.
// More information below.
"example.eu.org"
);
// Check if the domain is listed in the public suffix list
if (parseResult.type === ParseResultType.Listed) {
const { subDomains, domain, topLevelDomains } = parseResult;
console.log(subDomains); // []
console.log(domain); // "example"
console.log(topLevelDomains); // ["eu", "org"]
} else {
// Read more about other parseResult types below...
}
Expected result
org
Actual result
eu.org
The text was updated successfully, but these errors were encountered:
mehrdadep
changed the title
Wrong top level domain detection based on public suffix list
Wrong top level domain detection based on the public suffix list
Sep 7, 2022
We include private top-level domains by default as mentioned here. This is because browsers do this as well (when calculating the scope of a cookie for instance).
You can use the parseResult.icann property if you only care about ICANN domains:
Issue summary
As you can see here the
eu.org
belongs to the private domain section, so parsing a domain likeexample.eu.org
should returnorg
as the top-level domain, not theeu.org
(I've mistaken these two concepts as well and opened a similar issue for a php package.)Standalone code, or another way to reproduce the problem
Expected result
org
Actual result
eu.org
The text was updated successfully, but these errors were encountered: