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

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


The following commit(s) were added to refs/heads/dev by this push:
     new 4683901815 [Bug][zeta]rest api submit a job with chinese name return 
Garbled code name (#5870)
4683901815 is described below

commit 4683901815c494b30b70769777c180fb47d5222c
Author: fang <[email protected]>
AuthorDate: Fri Nov 17 11:35:19 2023 +0800

    [Bug][zeta]rest api submit a job with chinese name return Garbled code name 
(#5870)
---
 .../src/test/java/org/apache/seatunnel/engine/e2e/RestApiIT.java    | 4 ++--
 .../java/org/apache/seatunnel/engine/server/utils/RestUtil.java     | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiIT.java
 
b/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiIT.java
index eefefd80f9..0c5b7d2f6f 100644
--- 
a/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiIT.java
+++ 
b/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiIT.java
@@ -134,7 +134,7 @@ public class RestApiIT {
     @Test
     public void testSubmitJob() {
         Response response = submitJob("BATCH");
-        response.then().statusCode(200).body("jobName", equalTo("test"));
+        response.then().statusCode(200).body("jobName", equalTo("test测试"));
         String jobId = response.getBody().jsonPath().getString("jobId");
         SeaTunnelServer seaTunnelServer =
                 (SeaTunnelServer)
@@ -349,7 +349,7 @@ public class RestApiIT {
                         + "        }\n"
                         + "    ]\n"
                         + "}";
-        String parameters = "jobName=test";
+        String parameters = "jobName=test测试";
         if (isStartWithSavePoint) {
             parameters = parameters + "&isStartWithSavePoint=true";
         }
diff --git 
a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/utils/RestUtil.java
 
b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/utils/RestUtil.java
index 508db2f56a..7187cf49a8 100644
--- 
a/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/utils/RestUtil.java
+++ 
b/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/utils/RestUtil.java
@@ -29,6 +29,8 @@ import org.apache.seatunnel.engine.server.rest.RestConstant;
 import com.hazelcast.internal.util.StringUtil;
 
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
 import java.util.Map;
 
 public class RestUtil {
@@ -52,10 +54,12 @@ public class RestUtil {
         try {
             for (String s : uri.substring(indexEnd + 1).split("&")) {
                 String[] param = s.split("=");
-                requestParams.put(param[0], param[1]);
+                requestParams.put(param[0], URLDecoder.decode(param[1], 
"UTF-8"));
             }
         } catch (IndexOutOfBoundsException e) {
             throw new IllegalArgumentException("Invalid Params format in 
Params.");
+        } catch (UnsupportedEncodingException e) {
+            throw new IllegalArgumentException("Unsupported encoding exists in 
the parameter.");
         }
         if 
(Boolean.parseBoolean(requestParams.get(RestConstant.IS_START_WITH_SAVE_POINT))
                 && requestParams.get(RestConstant.JOB_ID) == null) {

Reply via email to