Files
lazyntfy/internal/tui/url.go
T

15 lines
259 B
Go
Raw Permalink Normal View History

package tui
import (
"fmt"
"net/url"
)
func validateURL(raw string) error {
u, err := url.Parse(raw)
if err != nil || u.Host == "" || (u.Scheme != "https" && u.Scheme != "http") {
return fmt.Errorf("only http(s) links can be opened")
}
return nil
}