Skip to content

Leading dots lead to INVALID even with lax validation e.g .reflectoring.io #158

@paradoxloop

Description

@paradoxloop

Thank you for great library. We use the library in both strict and lax mode depending on how flexible we want to be with the user input. One of the things that repeatly trips users up is they paste the domain with a leading dot having removed the subdomains but accidentally left the dot. Not sure if this is something the librar is meant to accept as valid input under lax.

const parseResult = parseDomain(fromUrl(".reflectoring.io"), { validation: Validation.Lax, }); console.log(parseResult);

Current Result:
{ type: 'INVALID', hostname: '.reflectoring.io', errors: [ { type: 'LABEL_MIN_LENGTH', message: 'Label "" is too short. Label is 0 octets long but should be at least 1.', column: 1 } ] }

Expected Result:
{ type: 'LISTED', hostname: 'reflectoring.io', labels: [ 'reflectoring', 'io' ], icann: { subDomains: [], domain: 'reflectoring', topLevelDomains: [ 'io' ] }, subDomains: [], domain: 'reflectoring', topLevelDomains: [ 'io' ] }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions