From 7caa7cd28efba90237cd3795503eb45b5baf788a Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 9 Jun 2022 18:22:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E6=AD=A5=E9=AA=A4=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=8D=95=E4=B8=AA=E6=AD=A5=E9=AA=A4=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E6=8D=A2=E8=A1=8C=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --bug=1011085 【测试跟踪】github#11377 #12246 功能用例的单个步骤如果有换行,在导出成xls文件,再导入后,会变成两个步骤 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001011085 --- .../java/io/metersphere/track/service/TestCaseService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 8124acc188..211fb3e442 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -1604,6 +1604,8 @@ public class TestCaseService { if(StringUtils.isEmpty(stepItem)){ stepItem = ""; } + //正则去空格、回车、换行符、制表符 + stepItem = stepItem.replaceAll("\\s*|\t|\r|\n", ""); step.append(num + "." + stepItem + "\n"); String resultItem = jsonArray.getJSONObject(j).getString("result"); if(StringUtils.isEmpty(resultItem)){ @@ -2748,4 +2750,5 @@ public class TestCaseService { List testCaseDTOS = publicListTestCase(request); return testCaseNodeService.getNodeByTestCases(testCaseDTOS); } + }