tomsun28 commented on code in PR #2532:
URL: https://github.com/apache/hertzbeat/pull/2532#discussion_r1719234870
##########
manager/src/main/java/org/apache/hertzbeat/manager/component/alerter/impl/AbstractAlertNotifyHandlerImpl.java:
##########
@@ -115,6 +115,42 @@ protected String renderContent(NoticeTemplate
noticeTemplate, Alert alert) throw
return template.replaceAll("((\r\n)|\n)[\\s\t ]*(\\1)+", "$1");
}
+ protected String escapeJsonStr(String jsonStr){
+ if (jsonStr == null) {
+ return null;
+ }
+
+ StringBuilder sb = new StringBuilder();
+ for (char c : jsonStr.toCharArray()) {
+ switch (c) {
+ case '"':
+ sb.append("\\\"");
+ break;
+ case '\\':
+ sb.append("\\\\");
+ break;
Review Comment:
Hi, should we consider the char `/` here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]