Create and use isValidURL
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type Person struct {
|
||||
@@ -30,7 +29,7 @@ func (p *Person) Check() error {
|
||||
}
|
||||
|
||||
if p.URI != "" {
|
||||
if _, err := url.ParseRequestURI(string(p.URI)); err != nil {
|
||||
if !isValidURL(p.URI) {
|
||||
return fmt.Errorf("uri element of person %v not correctly formatted", p.Name)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user