Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Matrix webhook #10831

Merged
merged 14 commits into from
Mar 28, 2020
Prev Previous commit
Next Next commit
Use stricter regex to replace URLs
Signed-off-by: Till Faelligen <[email protected]>
  • Loading branch information
S7evinK committed Mar 27, 2020
commit bd3496ce5da7ced8bdf286d36dd3899fea9fc6cf
2 changes: 1 addition & 1 deletion modules/webhook/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func GetMatrixPayload(p api.Payloader, event models.HookEventType, meta string)
return s, nil
}

var urlRegex = regexp.MustCompile(`<a.*?href="(.*?)">(.*?)</a>`)
var urlRegex = regexp.MustCompile(`<a [^>]*?href="([^">]*?)">(.*?)</a>`)

func getMessageBody(htmlText string) string {
htmlText = urlRegex.ReplaceAllString(htmlText, "[$2]($1)")
Expand Down