peerigon / peerigon/parse-domain
Leading dots lead to INVALID even with lax validation e.g .reflectoring.io
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 517
- Forks
- 70
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 3
Description
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' ]
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The report provides a reproduction using parseDomain(fromUrl(...)) with Validation.Lax, but names no files or tests. Start by reproducing the leading-dot case and inspect lax hostname validation; done means the result matches the listed LISTED output without the empty-label error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100