From fa580258ca139fcb2fcd1efe250919e78dd59278 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 8 Sep 2022 15:09:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20c?= =?UTF-8?q?ase=E6=88=96=E8=80=85=E5=9C=BA=E6=99=AF=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E4=B8=AD=E5=B8=A6/=EF=BC=8C=E4=BF=9D=E5=AD=98=E6=80=A7?= =?UTF-8?q?=E8=83=BD=E6=B5=8B=E8=AF=95=E6=8A=A5=E9=94=99=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1016355 --user=王孝刚 【接口测试】github#17452,接口自动化名字带 / ,转成性能测试保存会报错:文件上传失败 https://www.tapd.cn/55049933/s/1240778 --- .../main/java/io/metersphere/api/dto/JmxInfoDTO.java | 10 ++++++++-- .../api/dto/automation/ApiScenarioExportJmxDTO.java | 4 +++- .../performance/test/components/ExistScenarios.vue | 3 --- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/JmxInfoDTO.java b/backend/src/main/java/io/metersphere/api/dto/JmxInfoDTO.java index 3bb48daaef..79e290396f 100644 --- a/backend/src/main/java/io/metersphere/api/dto/JmxInfoDTO.java +++ b/backend/src/main/java/io/metersphere/api/dto/JmxInfoDTO.java @@ -3,6 +3,7 @@ package io.metersphere.api.dto; import io.metersphere.base.domain.FileMetadata; import lombok.Getter; import lombok.Setter; +import org.apache.commons.lang3.StringUtils; import java.util.List; import java.util.Map; @@ -22,9 +23,14 @@ public class JmxInfoDTO { private Map attachFiles; private List fileMetadataList; - public JmxInfoDTO(String name,String xml,Map attachFiles){ - this.name = name; + public JmxInfoDTO(String name, String xml, Map attachFiles) { + this.name = StringUtils.replace(name, "/", ""); this.xml = xml; this.attachFiles = attachFiles; } + + public void setName(String name) { + this.name = StringUtils.replace(name, "/", ""); + } + } diff --git a/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioExportJmxDTO.java b/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioExportJmxDTO.java index 4e33e7a413..81a4d2dc7d 100644 --- a/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioExportJmxDTO.java +++ b/backend/src/main/java/io/metersphere/api/dto/automation/ApiScenarioExportJmxDTO.java @@ -3,6 +3,7 @@ package io.metersphere.api.dto.automation; import io.metersphere.base.domain.FileMetadata; import lombok.Getter; import lombok.Setter; +import org.apache.commons.lang.StringUtils; import java.util.List; import java.util.Map; @@ -21,7 +22,8 @@ public class ApiScenarioExportJmxDTO { private Map> projectEnvMap; public ApiScenarioExportJmxDTO(String name, String jmx) { - this.name = name; + this.name = StringUtils.replace(name, "/", ""); this.jmx = jmx; } + } diff --git a/frontend/src/business/components/performance/test/components/ExistScenarios.vue b/frontend/src/business/components/performance/test/components/ExistScenarios.vue index bb7dca45f8..bcc6f784d8 100644 --- a/frontend/src/business/components/performance/test/components/ExistScenarios.vue +++ b/frontend/src/business/components/performance/test/components/ExistScenarios.vue @@ -143,9 +143,6 @@ export default { let data = returnData.scenarioJmxList; data.forEach(d => { let jmxName = d.name + "_" + new Date().getTime() + ".jmx"; - if (jmxName.indexOf("/") !== -1) { - jmxName = jmxName.replace(/\//g, ""); - } let threadGroups = findThreadGroup(d.jmx, jmxName); threadGroups.forEach(tg => { tg.options = {};