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

isURL() does not respect require_tld: true when validating http://localhost #675

Closed
hbakhtiyor opened this issue Jun 27, 2017 · 4 comments
Closed
Labels

Comments

@hbakhtiyor
Copy link

version: 7.1.0

i also set require_tld to true, neither work

> const isURL = require('validator').isURL;
undefined
> isURL('http://localhost', { protocols: ['http', 'https'], require_protocol: true });
true
> isURL('http://localhost', { protocols: ['http', 'https'], require_protocol: true, require_tld: true });
true

@hbakhtiyor
Copy link
Author

any updates?

@chriso
Copy link
Collaborator

chriso commented Jun 29, 2017

localhost is currently whitelisted as a valid hostname: https://github.com/chriso/validator.js/blob/c5037eff17a5a8884959eeac6689264333450af0/src/lib/isURL.js#L103. The whitelisting predates the require_tld option.

@hbakhtiyor
Copy link
Author

how to add it to blacklist?

@chriso chriso changed the title require_tld option of isURL checker doesn't work isURL() does not respect require_tld: true when validating http://localhost Jun 29, 2017
@chriso chriso closed this as completed in cc96615 Jul 7, 2017
@chriso
Copy link
Collaborator

chriso commented Jul 7, 2017

This is fixed in an upcoming release.

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

No branches or pull requests

2 participants