don't link missing mentions

This commit is contained in:
Ted Unangst 2019-04-15 23:48:01 -04:00
parent 7cb9c093c0
commit 3cfdaacdb3
1 changed files with 5 additions and 1 deletions

6
fun.go
View File

@ -181,7 +181,11 @@ func obfusbreak(s string) string {
s = strings.Replace(s, "\n", "<br>", -1)
s = re_mentions.ReplaceAllStringFunc(s, func(m string) string {
return fmt.Sprintf(`<a href="%s">%s</a>`, html.EscapeString(gofish(m)),
where := gofish(m)
if where == "" {
return m
}
return fmt.Sprintf(`<a href="%s">%s</a>`, html.EscapeString(where),
html.EscapeString(m))
})
return s