From befa6abd2edd61425621a258d9f2c0235e397182 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 7 Jul 2022 13:06:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20po?= =?UTF-8?q?stman=20=E5=AF=BC=E5=85=A5=E5=92=8Char=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E6=97=B6=E4=B8=8D=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --bug=1014714 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014715 --- .../api/dto/definition/parse/HarParser.java | 1 + .../parse/PostmanDefinitionParser.java | 14 ++++++-------- .../api/service/ApiModuleService.java | 16 ++++++---------- .../api/service/ApiScenarioModuleService.java | 9 +++------ 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java index 55f4d1ddc4..e2c94a1a67 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/HarParser.java @@ -88,6 +88,7 @@ public class HarParser extends HarAbstractParser { url = url.split("\\?")[0]; } } catch (Exception e) { + LogUtil.error(e.getMessage(), e); } //默认取路径的最后一块 diff --git a/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java b/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java index 051e792850..4cc4489db2 100644 --- a/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java +++ b/backend/src/main/java/io/metersphere/api/dto/definition/parse/PostmanDefinitionParser.java @@ -73,14 +73,12 @@ public class PostmanDefinitionParser extends PostmanAbstractParserParser { if (apiDefinitionWithBLOBs != null) { String modulePath = apiDefinitionWithBLOBs.getModulePath(); List moduleDatas = moduleOptionData.get(modulePath); - if (moduleDatas != null) { - if (moduleDatas.size() <= 1) { - moduleMap.remove(modulePath); - removeModulePath(moduleMap, moduleOptionData, modulePath); - } + if (moduleDatas != null && moduleDatas.size() <= 1) { + moduleMap.remove(modulePath); + removeModulePath(moduleMap, moduleOptionData, modulePath); moduleDatas.remove(apiDefinitionWithBLOBs); } optionData.remove(apiDefinitionWithBLOBs); @@ -980,11 +978,9 @@ public class ApiModuleService extends NodeTreeService { if (apiDefinitionWithBLOBs != null) { String modulePath = apiDefinitionWithBLOBs.getModulePath(); List moduleDatas = moduleOptionData.get(modulePath); - if (moduleDatas != null) { - if (moduleDatas.size() <= 1) { - moduleMap.remove(modulePath); - removeModulePath(moduleMap, moduleOptionData, modulePath); - } + if (moduleDatas != null && moduleDatas.size() <= 1) { + moduleMap.remove(modulePath); + removeModulePath(moduleMap, moduleOptionData, modulePath); moduleDatas.remove(apiDefinitionWithBLOBs); } diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java index ab4c1a34af..9b15059be1 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java @@ -603,13 +603,10 @@ public class ApiScenarioModuleService extends NodeTreeService moduleDatas = moduleOptionData.get(modulePath); - if (moduleDatas != null) { - if (moduleDatas.size() <= 1) { - moduleMap.remove(modulePath); - removeModulePath(moduleMap, moduleOptionData, modulePath); - } + if (moduleDatas != null && moduleDatas.size() <= 1) { + moduleMap.remove(modulePath); + removeModulePath(moduleMap, moduleOptionData, modulePath); moduleDatas.remove(apiScenarioWithBLOBs); - } optionData.remove(apiScenarioWithBLOBs); }