Alarting: fix alarm messages in dingding (Fixes #29470) (#29482)

This commit is contained in:
Tomo Wang 2020-12-02 18:09:49 +08:00 committed by GitHub
parent 863dbc7ba8
commit d33c4e5e7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,14 +119,14 @@ func (dd *DingDingNotifier) genBody(evalContext *alerting.EvalContext, messageUR
} }
for i, match := range evalContext.EvalMatches { for i, match := range evalContext.EvalMatches {
message += fmt.Sprintf("\\n%2d. %s: %s", i+1, match.Metric, match.Value) message += fmt.Sprintf("\n%2d. %s: %s", i+1, match.Metric, match.Value)
} }
var bodyMsg map[string]interface{} var bodyMsg map[string]interface{}
if dd.MsgType == "actionCard" { if dd.MsgType == "actionCard" {
// Embed the pic into the markdown directly because actionCard doesn't have a picUrl field // Embed the pic into the markdown directly because actionCard doesn't have a picUrl field
if dd.NeedsImage() && picURL != "" { if dd.NeedsImage() && picURL != "" {
message = "![](" + picURL + ")\\n\\n" + message message = "![](" + picURL + ")\n\n" + message
} }
bodyMsg = map[string]interface{}{ bodyMsg = map[string]interface{}{