govalidator icon indicating copy to clipboard operation
govalidator copied to clipboard

IsURL is accepting "http//" as legitimate URL prefix

Open mpkondrashin opened this issue 1 year ago • 2 comments

Bug Report

Summary

IsURL is accepting "http//" as legitimate URL prefix

github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2

Current behavior

govalidator.IsURL("http//abc.com") returns true.

How to reproduce

package main

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

func Main() {
	fmt.Println(govalidator.IsURL("http//abc.com"))
}

Expected behavior

IsURL is expected to return false for "http//abc.com"

mpkondrashin avatar Nov 18 '23 17:11 mpkondrashin

Just came across this error in my code. For now, I just check if it starts with http:// or https://, but it would be good if this issue is addressed soon since this package is used in a lot of production environments. Judging from the commit history, I don't have a lot of faith.

StrawHatHacker avatar Nov 27 '23 13:11 StrawHatHacker

I submitted a pull request for this

elkcityhazard avatar Dec 30 '23 16:12 elkcityhazard