What happened
While working on a Github action to send a release note to a Slack channel I saw that using the PostWebhook function causes the message to have weird characters in Slack due to the HTML escaping. For example, an apostrophe is converted to '.
Expected behavior
JSON marshaller only encodes the relevant characters as defined in the Slack documentation
Steps to reproduce
Send a webhook with an apostrophe in the body of the request. See that the resulting message has an HTML escaped symbol.
reproducible code
package main
import (
"github.com/slack-go/slack"
)
func main() {
blocks = new(slack.Blocks)
blocks.BlockSet = append(blocks.BlockSet, slack.NewSectionBlock(slack.NewTextBlockObject("mrkdwn", "'test' What's up", false, false), nil, nil))
_ := slack.PostWebhook("<WebhookURL>", &slack.WebhookMessage{Blocks: blocks})
}
manifest.yaml
Not sure what this is?
Versions
- Go: go version go1.21.5 darwin/arm64
- slack-go/slack:
v0.12.3