Skip to content

Commit aa70cf1

Browse files
Bump version to 2.1.7 (#708)
* [GH-692] Fix formatting inside code block in issue created notification (#697) * [MI-3405] Fix issue: improper formatting inside code block in issue created notification (#35) * [MI-3405] Fix issue: improper formatting inside code block in issue notification * [MI-3461] Add a comment to clearify the usage of code * Updated code to support less than and greater than symbols * Updated code to use html.UnescapeString * Review fix * [MI-3633] Updated logic to sanitize description only when a "<details>" tag is present in it. * Bump plugin version to v2.1.7 --------- Co-authored-by: Raghav Aggarwal <raghav.aggarwal@brightscout.com>
1 parent 926294c commit aa70cf1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"support_url": "https://github.com/mattermost/mattermost-plugin-github/issues",
77
"release_notes_url": "https://github.com/mattermost/mattermost-plugin-github/releases/tag/v2.1.6",
88
"icon_path": "assets/icon.svg",
9-
"version": "2.1.6",
9+
"version": "2.1.7",
1010
"min_server_version": "6.5.0",
1111
"server": {
1212
"executables": {

server/plugin/webhook.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"crypto/sha1" //nolint:gosec // GitHub webhooks are signed using sha1 https://developer.github.com/webhooks/.
77
"encoding/hex"
88
"encoding/json"
9+
"html"
910
"io"
1011
"net/http"
1112
"strings"
@@ -398,9 +399,12 @@ func (p *Plugin) postPullRequestEvent(event *github.PullRequestEvent) {
398399
}
399400

400401
func (p *Plugin) sanitizeDescription(description string) string {
401-
var policy = bluemonday.StrictPolicy()
402-
policy.SkipElementsContent("details")
403-
return strings.TrimSpace(policy.Sanitize(description))
402+
if strings.Contains(description, "<details>") {
403+
var policy = bluemonday.StrictPolicy()
404+
policy.SkipElementsContent("details")
405+
description = html.UnescapeString(policy.Sanitize(description))
406+
}
407+
return strings.TrimSpace(description)
404408
}
405409

406410
func (p *Plugin) handlePRDescriptionMentionNotification(event *github.PullRequestEvent) {

0 commit comments

Comments
 (0)