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

@@ -2,6 +2,7 @@ package atomfeed
import (
"mime"
"net/url"
"strings"
)
@@ -12,6 +13,11 @@ type (
URI string
)
func isValidURL(testURL URI) bool {
_, err := url.ParseRequestURI(string(testURL))
return err == nil
}
func isCompositeMediaType(mediaType string) bool {
mediaType, _, err := mime.ParseMediaType(mediaType)
if err != nil {