1
0
Fork 0
forked from forgejo/forgejo

Clean repo code

This commit is contained in:
Unknown 2014-05-05 19:58:13 -04:00
parent bbdfe25769
commit 6e3dba2cc5
13 changed files with 96 additions and 154 deletions

View file

@ -267,7 +267,10 @@ func validateStruct(errors *BindingErrors, obj interface{}) {
break
}
case rule == "Url":
if !urlPattern.MatchString(fmt.Sprintf("%v", fieldValue)) {
str := fmt.Sprintf("%v", fieldValue)
if len(str) == 0 {
continue
} else if !urlPattern.MatchString(str) {
errors.Fields[field.Name] = BindingUrlError
break
}