asaskevich / govalidator

[Go] Package of validators and sanitizers for strings, numerics, slices and structs
MIT License
6k stars 556 forks source link

Validation failing for IsURL() #445

Open orangemail opened 3 years ago

orangemail commented 3 years ago

I tried this sample string as input for IsURL(). i.e http://com/networks/

API is returning this as valid URL. Can you please correct it.

I saw this Regex in RFC 2396. Somehow if we can use if inside this API ...it will be more effective.

^(([^:/?#]+):)?(//([^/?#]))?([^?#])(\?([^#]))?(#(.))?

nathj07 commented 3 years ago

another example is http://invalid-link

dipesh23-apt commented 2 years ago

@orangemail Thanks for noticing this issue. I have opened pulled request to make sure the validation is correct for IsURL. I hope it gets merged as early as possible so that the users further do not face difficulties.

which infact is not a valid URL as the domain name is not specified(.com/.eu/.in should be in the URL) which in turn makes the 'govalidator package' work similar to the net/url package with a bug.

dipesh23-apt commented 2 years ago

https://github.com/asaskevich/govalidator/pull/451 - Fix: Checking of a Valid URL or not

sergeyglazyrindev commented 2 years ago

Hello guys! I forked this package cause owner disappeared. Hope, he will be back, but it would be easier to merge these changes back if he is back Link to my repo: create issue there and we'll discuss it.