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

top-level-domain validator accepts anything #1247

Closed
Ali-hd opened this issue Feb 11, 2020 · 2 comments
Closed

top-level-domain validator accepts anything #1247

Ali-hd opened this issue Feb 11, 2020 · 2 comments

Comments

@Ali-hd
Copy link

Ali-hd commented Feb 11, 2020

Hi there

Im testing some urls with wrong top-level-domain like "github.51.aljkuhjk" but it still gets passed as a valid url. I also made require_tld = true. It should compare it to this list link to check the available

@AubreyHewes
Copy link

@Ali-hd the require_tld check just ensures that the isFQDN, isURL or isEmail (unsure in your case) value has a TLD, not that it is a valid IANA gTLD...

i.e. localhost does NOT have a TLD and localhost.tld DOES have a tld..

What you want is to check against the IANA gTLD list
You can do this yourself by first checking that it has a TLD then checking the TLD against the list.

Hope this helps

@Ali-hd Ali-hd closed this as completed Feb 11, 2020
@AubreyHewes
Copy link

@Ali-hd just a tip.. when checking against the IANA gTLD list it would be wise to cache it as it does not change very often and would otherwise incur an extra network call on each "validation".. ;-)

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

2 participants