2
0
mirror of https://github.com/42wim/matterbridge synced 2024-11-19 03:25:33 +00:00

Allowed Slack bridge to extract simpler link format. (#287)

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-26 15:58:43 -04:00 committed by Wim
parent 95a0229aaf
commit 76aafe1fa8

View File

@ -410,7 +410,7 @@ func (b *Bslack) replaceMention(text string) string {
} }
func (b *Bslack) replaceURL(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 { for _, r := range results {
text = strings.Replace(text, r[0], r[1], -1) text = strings.Replace(text, r[0], r[1], -1)
} }