fix(测试跟踪): 导入xmind 增加校验保护
This commit is contained in:
parent
4d983fd071
commit
252e52d316
backend/src/main/java/io/metersphere
|
@ -255,7 +255,7 @@ public class TestCaseService {
|
|||
String processLog = new XmindToTestCaseParser(this, userId, projectId, testCaseNames).importXmind(multipartFile);
|
||||
if (!StringUtils.isEmpty(processLog)) {
|
||||
excelResponse.setSuccess(false);
|
||||
ExcelErrData excelErrData = new ExcelErrData(null, 1, processLog);
|
||||
ExcelErrData excelErrData = new ExcelErrData(null, 1, Translator.get("upload_fail")+":"+ processLog);
|
||||
errList.add(excelErrData);
|
||||
excelResponse.setErrList(errList);
|
||||
} else {
|
||||
|
|
|
@ -222,7 +222,10 @@ public class XmindToTestCaseParser {
|
|||
StringBuffer processBuffer = new StringBuffer();
|
||||
try {
|
||||
File file = multipartFileToFile(multipartFile);
|
||||
if (file == null || !file.exists())
|
||||
return Translator.get("incorrect_format");
|
||||
JsonRootBean root = XmindParser.parseObject(file);
|
||||
file.delete();
|
||||
if (root != null && root.getRootTopic() != null && root.getRootTopic().getChildren() != null) {
|
||||
// 判断是模块还是用例
|
||||
root.getRootTopic().getChildren().getAttached().forEach(item -> {
|
||||
|
|
Loading…
Reference in New Issue