Skip to content

Commit

Permalink
Bump version to 2.1.7 (#708)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
avas27JTG and raghavaggarwal2308 authored Nov 10, 2023
1 parent 926294c commit aa70cf1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
10 changes: 7 additions & 3 deletions server/plugin/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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, "<details>") {
var policy = bluemonday.StrictPolicy()
policy.SkipElementsContent("details")
description = html.UnescapeString(policy.Sanitize(description))
}
return strings.TrimSpace(description)
}

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

0 comments on commit aa70cf1

Please sign in to comment.