Skip to content

Commit bae18d7

Browse files
committed
Add json escape
1 parent 4d0c660 commit bae18d7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

service/cmd/server/main.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,14 @@ func makeGetRequest(endpoint string) *http.Response {
163163
func replaceQuotationMarks(value string) string {
164164
value = strings.Replace(value, "\"", "'", -1)
165165
value = strings.Replace(value, "\\'", "'", -1)
166-
return value
166+
167+
valueEscaped, err := json.Marshal(value)
168+
if err != nil {
169+
return value
170+
}
171+
valueEscaped = string(valueEscaped)
172+
173+
return valueEscaped[1:len(valueEscaped)-1]
167174
}
168175

169176
func addCommentToIssue(issueNumber string, subject string, sanitizedBody string, sender string) bool {

0 commit comments

Comments
 (0)