diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java index 781c48c502..80e8a19e58 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/Swagger2Parser.java @@ -39,7 +39,7 @@ public class Swagger2Parser extends SwaggerAbstractParser { if (StringUtils.isNotBlank(request.getSwaggerUrl())) { try { // 使用 url 导入 swagger - swagger = new SwaggerParser().read(request.getSwaggerUrl(), auths, true); + swagger = new SwaggerParser().read(request.getSwaggerUrl(), auths, false); } catch (Exception e) { LoggerUtil.error(e); MSException.throwException(e.getMessage()); diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java b/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java index c1cc12b24a..756fd299c0 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/request/ElementUtil.java @@ -113,7 +113,9 @@ public class ElementUtil { csvDataSet.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI")); csvDataSet.setName(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName()); csvDataSet.setProperty("fileEncoding", StringUtils.isEmpty(item.getEncoding()) ? "UTF-8" : item.getEncoding()); - if (CollectionUtils.isNotEmpty(item.getFiles())) { + if (CollectionUtils.isEmpty(item.getFiles())) { + MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ CSV文件不存在 ]"); + } else { if (!config.isOperating() && !new File(BODY_FILE_DIR + "/" + item.getFiles().get(0).getId() + "_" + item.getFiles().get(0).getName()).exists()) { MSException.throwException(StringUtils.isEmpty(item.getName()) ? "CSVDataSet" : item.getName() + ":[ CSV文件不存在 ]"); }