Skip to content

Commit

Permalink
bug-fixing - escape the double quotes for JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
haoel committed Mar 17, 2022
1 parent 39a101d commit c10bf7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions probe/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (r *Result) SlackBlockJSON() string {
body := fmt.Sprintf("*%s*\\n>%s %s - ⏱ %s\n>%s",
r.Title(), r.Status.Emoji(), r.Endpoint, rtt, JSONEscape(r.Message))
context := SlackTimeFormation(r.StartTime, " probed at ", r.TimeFormat)
summary := fmt.Sprintf("%s %s - %s", r.Title(), r.Status.Emoji(), r.Message )
summary := fmt.Sprintf("%s %s - %s", r.Title(), r.Status.Emoji(), JSONEscape(r.Message))
return fmt.Sprintf(json, summary, body, context)
}

Expand Down Expand Up @@ -360,7 +360,7 @@ func StatSlackBlockJSON(probers []Prober) string {
summary := fmt.Sprintf("Total %d Services, Average %.2f%% SLA", len(probers), sla)
json := `{
"channel": "Report",
"text": "Daily Overall SLA Report - `+ summary + ` ",
"text": "Daily Overall SLA Report - ` + summary + ` ",
"blocks": [
{
"type": "header",
Expand Down

0 comments on commit c10bf7d

Please sign in to comment.