-
Notifications
You must be signed in to change notification settings - Fork 9
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 function is not working as expected in some cases #2
Comments
Hello @carlos-ds Regarding the bug: I think you're right, I've been a little too shallow in writing that validator and I apologise I haven't noticed stack overflow already mentioned it wasn't a good regex to use. I would be glad if you want to contribute by changing that validator and its tests. At the moment I am working on a quite-big refectory of the library in order to allow validators to return a proper customisable and composable error message so I can't promise I will be able to fix this validator soon, I apologise. Please let me know if you'll fix the this validator tho :) cheers |
Oh btw... yes I will improve the documentation as soon as I finish the refactory |
Alright, but then perhaps it's best I have a go at that isURL function after you've done the necessary refactoring. When you come with more details on that refactoring, I might be able to help. |
@antonioru Great job on this library. I noticed isURL fails if there is a colon in the url, which is valid. It's probably better to completely refactor this function instead of patching with PRs. Thanks again for the hard work. |
@GregoryLebret-STW thanks for pointing this out I'm currently working on a huge refactory that shall allow validators to return error messages and developers to compose their own error messages. @carlos-ds pointed out that the https://github.com/antonioru/deep-waters/blob/feature/with-error/src/isURL.js This will be part of the release 1.0.0 which is due as soon as possible... |
Some interesting (I hope) new features I'm introducing with the refactory:
|
Hi,
First of all, I want to congratulate the author because I believe this is a very promising project. And you've obviously put a lot of time into this. If there is any way I can help, please let me know.
Now, to the point: I've been looking into the code and I've found that the isURL function is not always working as expected. For example, the following code returns true:
As you mentioned in the comments of isURL.js, the code for this function is derived from this Stackoverflow question. The example I've used above was also already mentioned in the comments on Stackoverflow as an invalid example.
Now, the question "what is a valid URL?" is indeed quire ambiguous. But to me, "www.google" should return false for this function. In any case, it would be best to either include specific documentation/examples to explain what works and what not. Were you thinking about also adding more documentation to this project?
As a second measure, we can try to improve the regular expression so that it returns false for these type of cases.
What do you think?
The text was updated successfully, but these errors were encountered: