-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Impossible to validate host (domain name or IP) #704
Comments
I'd be ok with making An alternative might be to disallow numeric TLDs? I'm not aware of any numeric gTLDs, and in fact this may not be allowed by ICANN. It'd be safest to control the behavior with a new option: Something like this @ isFQDN.js:31 would work: if (!options.allow_numeric_tld && i == parts.length - 1 && /^\d+$/.test(part)) {
return false; // reject numeric TLDs
} |
I guess you could do a check for IP address in The proposed |
this also fails. is this expected?
|
@maikelmclauflin try > validator.isURL('http://docker-continer-web')
false
> validator.isURL('http://docker-continer-web', { require_tld: false })
true |
Can someone close this issue as the PR is merged already |
Closing as resolved in #1474 |
Hi folks,
Just came across your library this morning and was quite surprised with the richness of it. Super nice!
Here's one one observation from a newbie: I've been trying to validate a host and have noticed that the combination of
isFQDN
andisIP
does match my expectations in a couple of edge cases.Check this out:
The function I've written is supposed to check environment variables in a microservice, so it's important to accept both domain names and IP addresses. It is also necessary to make sure there are no typos in the IP address (ideally both for ipv4 and ipv6).
How about making
isFQDN
a bit more strict? Or what aboutisHost()
that would work slightly better than a combination of two validators?The text was updated successfully, but these errors were encountered: