Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
paradoxloop opened this issue Mar 26, 2024 · 0 comments

Comments

@paradoxloop
Copy link

paradoxloop commented Mar 26, 2024

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' ] }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant