Skip to content

Default wildcard rule missing from the PSL algorithm implementation #338

@braedon

Description

@braedon

The PSL formal algorithm includes the following step:

  • If no rules match, the prevailing rule is "*".

This rule means that if an explicit public suffix can't be found for a domain in the PSL, the (actual, not effective) TLD is treated as a public suffix. This allows new TLDs (or custom internal TLDs) to be handled without requiring an explicit update to the PSL.

(It also means that the only time the PSL algorithm doesn't return a registrable domain is when the domain is itself a public suffix, which helps disambiguate that case.)

The PSL project has tests for this in the standard test suite:

// Unlisted TLD.
checkPublicSuffix('example', null);
checkPublicSuffix('example.example', 'example.example');
checkPublicSuffix('b.example.example', 'example.example');
checkPublicSuffix('a.b.example.example', 'example.example');

Here's the output for the test domains in tldextract 5.1.2:

>>> tldextract.extract('example').registered_domain                                                                                                                                                                                                                          
''
>>> tldextract.extract('example.example').registered_domain
''
>>> tldextract.extract('b.example.example').registered_domain
''
>>> tldextract.extract('a.b.example.example').registered_domain
''

The last three results are turning '', when they should return example.example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions