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 = {};