SbloodyS commented on code in PR #16683:
URL: 
https://github.com/apache/dolphinscheduler/pull/16683#discussion_r1796702284


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/ParameterUtils.java:
##########
@@ -314,15 +314,18 @@ private static String dateTemplateParse(String 
templateStr, Date date) {
     /**
      * handle escapes
      *
-     * @param inputString input string
+     * @param str input string
      * @return string filter escapes
      */
-    public static String handleEscapes(String inputString) {
-
-        if (!StringUtils.isEmpty(inputString)) {
-            return inputString.replace("%", "////%").replaceAll("[\n|\r\t]", 
"_");
+    public static String handleEscapes(String str) {
+        str = StringUtils.trim(str);
+        if (StringUtils.isNotBlank(str)) {
+            str = str.replace("\\", "\\\\");
+            str = str.replace("_", "\\_");
+            str = str.replace("%", "\\%");
+            str = str.replaceAll("[\n|\r\t]", "");

Review Comment:
   > I have checked all the calling places, and most of them use like % query. 
In addition, remove some don't need % escapr processing. @SbloodyS
   
   > Since the caller of this method is too extensive, it is impossible to 
comprehensively evaluate the influence surface. In order to reduce the impact 
and achieve the optimization effect, it is better to deal with it separately.
   
   The scope of this revision is relatively large and it does not belong to the 
description scope of this issue #16682 . In this Fix PR, we only need to 
extract the query of workflow list separately and fix it. The other is to 
create a DSIP for scheme design and discussion.



-- 
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]

Reply via email to