From 953de9c86d795bc53c71311c0067d68bf855b3b4 Mon Sep 17 00:00:00 2001 From: Martin Dosch Date: Wed, 1 May 2024 10:30:17 +0200 Subject: [PATCH] Fix check for valid URIs. --- helpers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helpers.go b/helpers.go index 6acc08b..fe2fe57 100644 --- a/helpers.go +++ b/helpers.go @@ -37,7 +37,10 @@ func validUTF8(s string) string { func validURI(s string) (*url.URL, error) { // Check if URI is valid uri, err := url.ParseRequestURI(s) - return uri, fmt.Errorf("validURI: %w", err) + if err != nil { + return uri, fmt.Errorf("validURI: %w", err) + } + return uri, nil } func readFile(path string) (*bytes.Buffer, error) {