Allowed Slack bridge to extract simpler link format.

Links sometimes exist without bar delimiters.

See: https://api.slack.com/docs/message-formatting#linking_to_urls
This commit is contained in:
Patrick Connolly
2017-10-25 16:55:14 -04:00
parent 95a0229aaf
commit d0b73ceec5

View File

@@ -410,7 +410,7 @@ func (b *Bslack) replaceMention(text string) string {
}
func (b *Bslack) replaceURL(text string) string {
results := regexp.MustCompile(`<(.*?)\|.*?>`).FindAllStringSubmatch(text, -1)
results := regexp.MustCompile(`<(.*?)(\|.*?)?>`).FindAllStringSubmatch(text, -1)
for _, r := range results {
text = strings.Replace(text, r[0], r[1], -1)
}