diff --git a/main.go b/main.go index 3899b07..ef4be85 100644 --- a/main.go +++ b/main.go @@ -82,6 +82,7 @@ func main() { "escapeString": html.EscapeString, "sanitizeXSS": sanitizeXSS, "trimProtocol": trimProtocol, + "normalizeWebsiteURL": normalizeWebsiteURL, } tmpl = template.Must( diff --git a/templates/profile.html b/templates/profile.html index fd34d77..e1843a2 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -78,7 +78,7 @@
- {{.metadata.Website | escapeString}}
diff --git a/utils.go b/utils.go index 85d58a0..58d3bdf 100644 --- a/utils.go +++ b/utils.go @@ -435,6 +435,13 @@ func trimProtocol(relay string) string { return relay } +func normalizeWebsiteURL(u string) string { + if strings.HasPrefix(u, "http") { + return u + } + return "https://" + u +} + func loadNpubsArchive(ctx context.Context) { log.Debug().Msg("refreshing the npubs archive")