Fix formatLinks() not working
This broke when moving to the standard library for escaping and unescaping HTML. The original escaping code replaced "//" with "&x2F;&x2F;" while the standard library doesn't.
This commit is contained in:
parent
86ba07b4f7
commit
b62b89c13e
|
@ -88,8 +88,7 @@ func (cl *Client) NewMsg(msg string) {
|
|||
func formatLinks(input string) string {
|
||||
newMsg := []string{}
|
||||
for _, word := range strings.Split(input, " ") {
|
||||
if strings.HasPrefix(word, "http://") || strings.HasPrefix(word, "https://") {
|
||||
//word = unescape(word)
|
||||
if strings.HasPrefix(word, "http://") || strings.HasPrefix(word, "https://") {
|
||||
word = html.UnescapeString(word)
|
||||
word = fmt.Sprintf(`<a href="%s" target="_blank">%s</a>`, word, word)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue