From f0bc12c98ff3e4681eaa9611f8bfa43bebf5f0fb Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 22 Sep 2021 18:07:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=A8=A1=E5=9D=97=E6=A0=91=E7=BB=84?= =?UTF-8?q?=E4=BB=B6):=20#1006836=20=E3=80=90=E6=8E=A5=E5=8F=A3=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E3=80=91=E6=96=B0=E5=BB=BA=E5=AD=90=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=9A=E8=87=AA=E5=8A=A8=E6=8A=98=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【【接口定义】新建子模块会自动折叠】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006836 --- .../api/dto/definition/parse/HarParser.java | 11 ++++++----- .../src/business/components/track/common/NodeTree.vue | 1 + 2 files changed, 7 insertions(+), 5 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 eef0424ac5..fc9f9134ce 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 @@ -17,6 +17,7 @@ import io.metersphere.commons.utils.LogUtil; import io.metersphere.commons.utils.XMLUtils; import io.swagger.models.Model; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; @@ -46,11 +47,9 @@ public class HarParser extends HarAbstractParser { MSException.throwException(e.getMessage()); LogUtil.error(e.getMessage(), e); } - if (ObjectUtils.isEmpty(har)) { MSException.throwException("解析失败,请确认选择的是 Har 格式!"); } - ApiDefinitionImport definitionImport = new ApiDefinitionImport(); this.projectId = request.getProjectId(); definitionImport.setData(parseRequests(har, request)); @@ -213,9 +212,11 @@ public class HarParser extends HarAbstractParser { } else if (contentType.startsWith(org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE)) { contentType = org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE; List postParams = content.params; - for (HarPostParam postParam : postParams) { - KeyValue kv = new KeyValue(postParam.name,postParam.value); - body.getKvs().add(kv); + if(CollectionUtils.isNotEmpty(postParams)){ + for (HarPostParam postParam : postParams) { + KeyValue kv = new KeyValue(postParam.name,postParam.value); + body.getKvs().add(kv); + } } } else if (contentType.startsWith(org.springframework.http.MediaType.APPLICATION_JSON_VALUE)) { contentType = org.springframework.http.MediaType.APPLICATION_JSON_VALUE; diff --git a/frontend/src/business/components/track/common/NodeTree.vue b/frontend/src/business/components/track/common/NodeTree.vue index b3ad91eee6..86772975d9 100644 --- a/frontend/src/business/components/track/common/NodeTree.vue +++ b/frontend/src/business/components/track/common/NodeTree.vue @@ -327,6 +327,7 @@ export default { if (param.type === 'edit') { this.$emit('edit', param); } else { + this.expandedNode.push(param.parentId); this.$emit('add', param); } this.$set(data, 'isEdit', false);