Create and use isValidURL
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user