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 - email addresses validate as URLs #707

Closed
iamjochem opened this issue Aug 31, 2017 · 3 comments · Fixed by #901
Closed

isURL - email addresses validate as URLs #707

iamjochem opened this issue Aug 31, 2017 · 3 comments · Fixed by #901

Comments

@iamjochem
Copy link

hi,

most people would guess that the string john@doe.com is an email address, but technically it is also a valid URL (an "auth" segment and a "hostname" segment).

isURL validates the above string, it would be nice if a option existed, e.g. allow_auth, whereby we could specify that URLs with an auth are invalid.

In my particular case would allow me to invalidate email-addresses that people mistakenly submit in place of actual URLs ... these things do happen for all sorts of reasons (e.g. carelessness, bad UI, misunderstanding, etc)

@simison
Copy link
Contributor

simison commented Oct 24, 2017

+1

Meanwhile:

function isURLWithoutAuth(url) {
  return typeof url === 'string' && !validator.isEmail(url) && validator.isURL(url);
}

@shirbr510
Copy link

+1

@profnandaa
Copy link
Member

@simison - happy to accept PR! 👍

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

Successfully merging a pull request may close this issue.

5 participants