diff --git a/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java b/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java index b5ace2564d..36a7b5dd22 100644 --- a/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java +++ b/backend/src/main/java/io/metersphere/api/parse/PostmanAbstractParserParser.java @@ -54,6 +54,9 @@ public abstract class PostmanAbstractParserParser extends ApiImportAbstractPa * @return */ public String parseVariable(String value) { + if (StringUtils.isBlank(value)) { + return value; + } try { Pattern pattern = Pattern.compile("(\\{\\{(.*?)\\}\\})"); Matcher matcher = pattern.matcher(value); @@ -107,7 +110,11 @@ public abstract class PostmanAbstractParserParser extends ApiImportAbstractPa String k = parseVariable(item.getKey()); String v = parseVariable(item.getValue()); String desc = parseVariable(item.getDescription()); - keyValues.add(new KeyValue(k, v, desc, item.getContentType())); + KeyValue keyValue = new KeyValue(k, v, desc, item.getContentType()); + if (StringUtils.isNotBlank(item.getType()) && StringUtils.equals("file", item.getType())) { + keyValue.setType("file"); + } + keyValues.add(keyValue); }); return keyValues; } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 1768012427..5f64a62ec4 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -798,6 +798,7 @@ public class ApiDefinitionService { if (i % 300 == 0) { sqlSession.flushStatements(); } + sqlSession.flushStatements(); } //判断EsbData是否需要存储 if (apiImport.getEsbApiParamsMap() != null && apiImport.getEsbApiParamsMap().size() > 0) { @@ -819,7 +820,6 @@ public class ApiDefinitionService { if (!CollectionUtils.isEmpty(apiImport.getCases())) { importMsCase(apiImport, sqlSession, apiTestCaseMapper); } - sqlSession.flushStatements(); }