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

URL validation incorrectly require a period in the authority #59

Open
bendemboski opened this issue Feb 2, 2018 · 0 comments
Open

URL validation incorrectly require a period in the authority #59

bendemboski opened this issue Feb 2, 2018 · 0 comments

Comments

@bendemboski
Copy link
Member

In the URL regex:

/(?:([A-Za-z]+):)?(\/{0,3})[a-zA-Z0-9][a-zA-Z-0-9]*(\.[\w-]+)+([\w.,@?^=%&:\/~+#-{}]*[\w@?^=%&\/~+#-{}])??/

the (\.[\w-]+)+ is incorrect as it requires at least one dot in the authority, which is not a requirement of valid URLs, and prevents, for example, using http://localhost which is a valid URL. I think maybe changing the \. to a \.? would fix it, but rather than hacking on the existing regex, it probably makes sense to go and find a regex or library that validates URLs and doesn't exhibit this bug.

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

1 participant