accept relay URLs without scheme everywhere.

This commit is contained in:
fiatjaf
2024-06-06 15:38:40 -03:00
parent eccce6dc4a
commit 363bd66a8a
3 changed files with 10 additions and 7 deletions

View File

@@ -92,8 +92,11 @@ func writeStdinLinesOrNothing(ch chan string) (hasStdinLines bool) {
}
}
func validateRelayURLs(wsurls []string) error {
for _, wsurl := range wsurls {
func normalizeAndValidateRelayURLs(wsurls []string) error {
for i, wsurl := range wsurls {
wsurl = nostr.NormalizeURL(wsurl)
wsurls[i] = wsurl
u, err := url.Parse(wsurl)
if err != nil {
return fmt.Errorf("invalid relay url '%s': %s", wsurl, err)