asaskevich / govalidator

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

Weird URL Validation #398

Closed edoardottt closed 4 years ago

edoardottt commented 4 years ago

Bug Report

Q A
Version(s) 11

Summary

Maybe i didn't understood well the docs, but I think I encountered a weird thing.

Current behavior

On validate the URL 100.55.44.36ewretyt4r3wewd3, the method govalidator.IsURL() returns true

How to reproduce

package main

import (
    "fmt"
    "github.com/asaskevich/govalidator"
)

func main() {
    validURL := govalidator.IsURL("100.55.44.36ewretyt4r3wewd3")
    fmt.Println(validURL)
}

Expected behavior

The code (I think) should print false

edoardottt commented 4 years ago

Ok. Then I've understood ahah. That was only a URL validator, there are also Ipv4 and Ipv6 validators. Clearly 100.55.44.36ewretyt4r3wewd3 is a valid URL, but it isn't a valid Ip.