feat(接口定义): case或者场景名称中带/,保存性能测试报错的缺陷

--bug=1016355 --user=王孝刚 【接口测试】github#17452,接口自动化名字带 /
,转成性能测试保存会报错:文件上传失败 https://www.tapd.cn/55049933/s/1240778
This commit is contained in:
wxg0103 2022-09-08 15:09:08 +08:00 committed by fit2-zhao
parent a6904f1e5e
commit fa580258ca
3 changed files with 11 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package io.metersphere.api.dto;
import io.metersphere.base.domain.FileMetadata; import io.metersphere.base.domain.FileMetadata;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -23,8 +24,13 @@ public class JmxInfoDTO {
private List<FileMetadata> fileMetadataList; private List<FileMetadata> fileMetadataList;
public JmxInfoDTO(String name, String xml, Map<String, String> attachFiles) { public JmxInfoDTO(String name, String xml, Map<String, String> attachFiles) {
this.name = name; this.name = StringUtils.replace(name, "/", "");
this.xml = xml; this.xml = xml;
this.attachFiles = attachFiles; this.attachFiles = attachFiles;
} }
public void setName(String name) {
this.name = StringUtils.replace(name, "/", "");
}
} }

View File

@ -3,6 +3,7 @@ package io.metersphere.api.dto.automation;
import io.metersphere.base.domain.FileMetadata; import io.metersphere.base.domain.FileMetadata;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.apache.commons.lang.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -21,7 +22,8 @@ public class ApiScenarioExportJmxDTO {
private Map<String, List<String>> projectEnvMap; private Map<String, List<String>> projectEnvMap;
public ApiScenarioExportJmxDTO(String name, String jmx) { public ApiScenarioExportJmxDTO(String name, String jmx) {
this.name = name; this.name = StringUtils.replace(name, "/", "");
this.jmx = jmx; this.jmx = jmx;
} }
} }

View File

@ -143,9 +143,6 @@ export default {
let data = returnData.scenarioJmxList; let data = returnData.scenarioJmxList;
data.forEach(d => { data.forEach(d => {
let jmxName = d.name + "_" + new Date().getTime() + ".jmx"; let jmxName = d.name + "_" + new Date().getTime() + ".jmx";
if (jmxName.indexOf("/") !== -1) {
jmxName = jmxName.replace(/\//g, "");
}
let threadGroups = findThreadGroup(d.jmx, jmxName); let threadGroups = findThreadGroup(d.jmx, jmxName);
threadGroups.forEach(tg => { threadGroups.forEach(tg => {
tg.options = {}; tg.options = {};