Change URI to IRI after finding validation pattern

This commit is contained in:
2024-10-16 17:33:25 +02:00
parent b76e529ca3
commit 082e71a698
10 changed files with 41 additions and 32 deletions

View File

@@ -10,7 +10,7 @@ import (
type OutOfLineContent struct {
*CommonAttributes
Type MediaType `xml:"type,attr,omitempty"`
SRC URI `xml:"src,attr"`
SRC IRI `xml:"src,attr"`
}
func newOutOfLineContent(mediaType string, content any) (*OutOfLineContent, error) {
@@ -22,11 +22,11 @@ func newOutOfLineContent(mediaType string, content any) (*OutOfLineContent, erro
return nil, fmt.Errorf("content type %T incompatible with out of line content", content)
}
if !isValidURI(content.(URI)) {
if !isValidIRI(content.(IRI)) {
return nil, errors.New("content not a valid uri")
}
return &OutOfLineContent{Type: MediaType(mediaType), SRC: content.(URI)}, nil
return &OutOfLineContent{Type: MediaType(mediaType), SRC: content.(IRI)}, nil
}
func (o *OutOfLineContent) isContent() bool { return true }