fix(接口定义): 修复接口定义带/导致转存性能测试失败的缺陷 (#17485)

--bug=1016355 --user=王孝刚 【接口测试】github#17452,接口自动化名字带 /
,转成性能测试保存会报错:文件上传失败 https://www.tapd.cn/55049933/s/1234397

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-08-29 13:54:39 +08:00 committed by GitHub
parent 58359cb409
commit 4c25c046a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 45 additions and 41 deletions

View File

@ -301,6 +301,7 @@ public class EngineFactory {
try { try {
Element hashTree = null; Element hashTree = null;
Document rootDocument = null; Document rootDocument = null;
if (CollectionUtils.isNotEmpty(jmxFiles)) {
for (FileMetadata fileMetadata : jmxFiles) { for (FileMetadata fileMetadata : jmxFiles) {
// 兼容处理 // 兼容处理
byte[] bytes = fileMetadataService.loadFileAsBytes(fileMetadata.getId()); byte[] bytes = fileMetadataService.loadFileAsBytes(fileMetadata.getId());
@ -344,10 +345,10 @@ public class EngineFactory {
} }
} }
//
inputSource.close(); inputSource.close();
} }
return EngineSourceParserFactory.getBytes(rootDocument); return EngineSourceParserFactory.getBytes(rootDocument);
}
} catch (Exception e) { } catch (Exception e) {
MSException.throwException(e); MSException.throwException(e);
} }

View File

@ -143,6 +143,9 @@ 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 = {};