diff --git a/plugin.json b/plugin.json index bdd22397b..955f97409 100644 --- a/plugin.json +++ b/plugin.json @@ -6,7 +6,7 @@ "support_url": "https://github.com/mattermost/mattermost-plugin-github/issues", "release_notes_url": "https://github.com/mattermost/mattermost-plugin-github/releases/tag/v2.1.6", "icon_path": "assets/icon.svg", - "version": "2.1.6", + "version": "2.1.7", "min_server_version": "6.5.0", "server": { "executables": { diff --git a/server/plugin/webhook.go b/server/plugin/webhook.go index 043b9a419..d86c82534 100644 --- a/server/plugin/webhook.go +++ b/server/plugin/webhook.go @@ -6,6 +6,7 @@ import ( "crypto/sha1" //nolint:gosec // GitHub webhooks are signed using sha1 https://developer.github.com/webhooks/. "encoding/hex" "encoding/json" + "html" "io" "net/http" "strings" @@ -398,9 +399,12 @@ func (p *Plugin) postPullRequestEvent(event *github.PullRequestEvent) { } func (p *Plugin) sanitizeDescription(description string) string { - var policy = bluemonday.StrictPolicy() - policy.SkipElementsContent("details") - return strings.TrimSpace(policy.Sanitize(description)) + if strings.Contains(description, "
") { + var policy = bluemonday.StrictPolicy() + policy.SkipElementsContent("details") + description = html.UnescapeString(policy.Sanitize(description)) + } + return strings.TrimSpace(description) } func (p *Plugin) handlePRDescriptionMentionNotification(event *github.PullRequestEvent) {