From b7c214e9103510b7f0d4f986fbf99188401f4886 Mon Sep 17 00:00:00 2001 From: Adhityaa Chandrasekar Date: Thu, 13 Feb 2020 20:01:44 -0500 Subject: [PATCH] commenter_update.go: parse empty links as undefined --- api/commenter_update.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/commenter_update.go b/api/commenter_update.go index 3446995..388a07f 100644 --- a/api/commenter_update.go +++ b/api/commenter_update.go @@ -12,7 +12,9 @@ func commenterUpdate(commenterHex string, email string, name string, link string // See utils_sanitise.go's documentation on isHttpsUrl. This is not a URL // validator, just an XSS preventor. // TODO: reject URLs instead of malforming them. - if link != "undefined" && !isHttpsUrl(link) { + if link == "" { + link = "undefined" + } else if link != "undefined" && !isHttpsUrl(link) { link = "https://" + link }