From a11b8e2217a64b30df1443865cac58e21e18bdf0 Mon Sep 17 00:00:00 2001 From: yizzuide Date: Wed, 18 Nov 2020 16:39:43 +0800 Subject: [PATCH] fix(echo) Automatically recognizes and removes string backslashes. --- Milkomeda/pom.xml | 4 ++-- .../com/github/yizzuide/milkomeda/echo/EchoRequest.java | 7 ++++++- MilkomedaDemo/pom.xml | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Milkomeda/pom.xml b/Milkomeda/pom.xml index 50069e8d..8fbbea43 100755 --- a/Milkomeda/pom.xml +++ b/Milkomeda/pom.xml @@ -11,7 +11,7 @@ 1.8 - 3.12.7-SNAPSHOT + 3.12.8-SNAPSHOT 2.2.4 Hoxton.RELEASE 2.1.1 @@ -67,7 +67,7 @@ sonatype-oss-release - 3.12.7 + 3.12.8 diff --git a/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/echo/EchoRequest.java b/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/echo/EchoRequest.java index dfb84eea..bcc3aba0 100644 --- a/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/echo/EchoRequest.java +++ b/Milkomeda/src/main/java/com/github/yizzuide/milkomeda/echo/EchoRequest.java @@ -19,7 +19,7 @@ * * @author yizzuide * @since 1.13.0 - * @version 3.12.7 + * @version 3.12.8 * Create at 2019/09/21 19:00 */ @Slf4j @@ -104,6 +104,7 @@ protected EchoResponseData createReturnData(Object respData, TypeReferenc if (isStringType) { return responseData; } + // 去字符串符和反斜杠 String dataStr = (String) responseData.getData(); if (dataStr.startsWith("\"")) { dataStr = dataStr.substring(1); @@ -111,6 +112,10 @@ protected EchoResponseData createReturnData(Object respData, TypeReferenc if (dataStr.endsWith("\"")) { dataStr = dataStr.substring(0, dataStr.length() - 1); } + if (dataStr.contains("\\")) { + dataStr = dataStr.replaceAll("\\\\", ""); + } + // 驼峰转换 if (forceCamel) { responseData.setData(JSONUtil.toCamel(dataStr, specType)); return responseData; diff --git a/MilkomedaDemo/pom.xml b/MilkomedaDemo/pom.xml index 04a89f83..b9d453f4 100644 --- a/MilkomedaDemo/pom.xml +++ b/MilkomedaDemo/pom.xml @@ -20,7 +20,7 @@ UTF-8 1.8 Hoxton.RELEASE - 3.12.7-SNAPSHOT + 3.12.8-SNAPSHOT 2.1.1 3.12.5 3.4.14