Create isValidURN and isValidURI and use isValidURI everywhere where it is needed

This commit is contained in:
2024-10-16 16:48:44 +02:00
parent 14696371e2
commit c200d5bf73
4 changed files with 20 additions and 4 deletions

View File

@@ -27,6 +27,12 @@ func (c *Category) Check() error {
return errors.New("term attribute of category empty")
}
if c.Scheme != "" {
if !isValidURI(c.Scheme) {
return fmt.Errorf("scheme attribute of category %v not correctly formatted", c.Scheme)
}
}
if c.Content == nil {
return errors.New("no content element of category")
} else {