commenter_update.go: parse empty links as undefined

This commit is contained in:
Adhityaa Chandrasekar 2020-02-13 20:01:44 -05:00
parent ea3419e8b4
commit b7c214e910

View File

@ -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 // See utils_sanitise.go's documentation on isHttpsUrl. This is not a URL
// validator, just an XSS preventor. // validator, just an XSS preventor.
// TODO: reject URLs instead of malforming them. // 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 link = "https://" + link
} }