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 bug #518

Closed
tomgrossman opened this issue Mar 14, 2016 · 3 comments
Closed

isURL bug #518

tomgrossman opened this issue Mar 14, 2016 · 3 comments
Labels

Comments

@tomgrossman
Copy link
Contributor

Hi,
In case there is a reference to a URL not in the beginning of the main URL, the validator returns false.
For example:
this returns true:
validator.isURL('http://test.com?ref=http://test2.com')

but this returns false:
validator.isURL('test.com?ref=http://test2.com')

they are exactly the same except that the second one has no "http://" in the beginning.

@chriso
Copy link
Collaborator

chriso commented Mar 14, 2016

I don't think either of those are valid URLs, technically. You need to escape query key/value pairs (e.g. with encodeURIComponent):

> validator.isURL('test.com?ref=http%3A%2F%2Ftest2.com');
true

@chriso
Copy link
Collaborator

chriso commented Mar 14, 2016

That said, your browser and command line tools probably interpret the URL correctly without the need for escaped query string values, so we could possibly allow it too.

@chriso
Copy link
Collaborator

chriso commented Mar 14, 2016

Ah I see that we already do allow it, as long as the protocol is present. This is a bug then, thanks for reporting.

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