Create and use isValidURL

This commit is contained in:
2024-10-16 16:14:34 +02:00
parent 4f70da9a17
commit 14696371e2
3 changed files with 8 additions and 4 deletions

View File

@@ -4,7 +4,6 @@ import (
"errors"
"fmt"
"mime"
"net/url"
"reflect"
)
@@ -23,7 +22,7 @@ func newOutOfLineContent(mediaType string, content any) (*OutOfLineContent, erro
return nil, fmt.Errorf("content type %T incompatible with out of line content", content)
}
if _, err := url.ParseRequestURI(content.(string)); err != nil {
if !isValidURL(content.(URI)) {
return nil, errors.New("content not a valid uri")
}