Change URI to IRI after finding validation pattern
This commit is contained in:
6
icon.go
6
icon.go
@@ -7,18 +7,18 @@ import (
|
||||
|
||||
type Icon struct {
|
||||
*CommonAttributes
|
||||
URI URI `xml:"uri"`
|
||||
URI IRI `xml:"uri"`
|
||||
}
|
||||
|
||||
func NewIcon(uri string) *Icon {
|
||||
return &Icon{URI: URI(uri)}
|
||||
return &Icon{URI: IRI(uri)}
|
||||
}
|
||||
|
||||
func (i *Icon) Check() error {
|
||||
if i.URI == "" {
|
||||
return errors.New("uri element of icon empty")
|
||||
} else {
|
||||
if !isValidURI(i.URI) {
|
||||
if !isValidIRI(i.URI) {
|
||||
return fmt.Errorf("uri attribute %v of icon not correctly formatted", i.URI)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user