You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ch...@apache.org on 2024/03/18 12:25:01 UTC

(dolphinscheduler) branch dev updated: Fix switch js, add black key (#15680)

This is an automated email from the ASF dual-hosted git repository.

chufenggao pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 4a255fd523 Fix switch js, add black key (#15680)
4a255fd523 is described below

commit 4a255fd523cf730bc151516485d928e99e68f970
Author: caishunfeng <ca...@gmail.com>
AuthorDate: Mon Mar 18 20:24:54 2024 +0800

    Fix switch js, add black key (#15680)
    
    Co-authored-by: fuchanghai <ch...@apache.org>
    Co-authored-by: Eric Gao <er...@gmail.com>
---
 .../dolphinscheduler/server/master/utils/SwitchTaskUtils.java  |  4 ++++
 .../server/master/utils/SwitchTaskUtilsTest.java               | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java
index 40686474a4..2837f69022 100644
--- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java
+++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtils.java
@@ -50,6 +50,10 @@ public class SwitchTaskUtils {
             "eval",
             "function",
             "import",
+            ".",
+            "()",
+            "[",
+            "]",
             "\\\\");
 
     static {
diff --git a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java
index e0654882ec..ef289d0757 100644
--- a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java
+++ b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/utils/SwitchTaskUtilsTest.java
@@ -65,5 +65,15 @@ public class SwitchTaskUtilsTest {
             SwitchTaskUtils.generateContentWithTaskParams(contentWithUnicode, globalParams, varParams);
         });
 
+        String contentWithSpecify1 = "cmd.abc";
+        Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> {
+            SwitchTaskUtils.generateContentWithTaskParams(contentWithSpecify1, globalParams, varParams);
+        });
+
+        String contentWithSpecify2 = "cmd()";
+        Assertions.assertThrowsExactly(IllegalArgumentException.class, () -> {
+            SwitchTaskUtils.generateContentWithTaskParams(contentWithSpecify2, globalParams, varParams);
+        });
+
     }
 }