asaskevich / govalidator

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

URL validation doest not work on url.URL situation #154

Open arxdsilva opened 8 years ago

arxdsilva commented 8 years ago

Hello!

I'm using this package to validate URLs before inserting it on a DB of a url Shortener, but when moving my shortener to another package I wanted to use the URLs with go's url.URL package. So when I tried to parse It into the validator It returns as true in a test that should not.

Example: Link

arxdsilva commented 8 years ago

Also passing (but should not):

&url.URL{
    Scheme: "https",
    Host:   "",
    Path:   "notvalid/path",
}
&url.URL{
    Scheme: "https",
    Host:   "notvalid",
    Path:   "",
},
asaskevich commented 7 years ago

Could you provide stringified examples, please? Something like https:///notvalid/path

zupzup commented 7 years ago

https://notvalid/path and https://notvalid are the stringified versions of the above example, which are both valid URLs (e.g.: http://localhost and http://localhost/some/path)

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.