From 931782a9e2aae4f8f0557fbda47ec04eba2d777a Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 22 Mar 2023 10:06:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0=E6=8F=92=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E5=9C=A8=E5=88=97=E8=A1=A8=E6=B2=A1=E6=9C=89=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1024721 --user=王孝刚 【系统设置】github#23006,上传jmeter的jar提示上传成功,在日志中查询到上传成功,但是在列表中没有展示出来 https://www.tapd.cn/55049933/s/1354181 --- .../io/metersphere/service/PluginService.java | 30 ++++++++++++------- .../resources/i18n/messages_en_US.properties | 3 +- .../resources/i18n/messages_zh_CN.properties | 3 +- .../resources/i18n/messages_zh_TW.properties | 3 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/system-setting/backend/src/main/java/io/metersphere/service/PluginService.java b/system-setting/backend/src/main/java/io/metersphere/service/PluginService.java index c4911f48b5..5016f58f96 100644 --- a/system-setting/backend/src/main/java/io/metersphere/service/PluginService.java +++ b/system-setting/backend/src/main/java/io/metersphere/service/PluginService.java @@ -11,6 +11,7 @@ import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.FileUtils; import io.metersphere.commons.utils.JSON; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.i18n.Translator; import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.OperatingLogDetails; @@ -126,19 +127,26 @@ public class PluginService { public void addPlugin(MultipartFile file, String scenario) { checkPluginExist(file); - if (StringUtils.equalsIgnoreCase(scenario, PluginScenario.platform.name())) { - PluginWithBLOBs plugin = platformPluginService.addPlatformPlugin(file); - platformPluginService.notifiedPlatformPluginAdd(plugin.getId()); - } else { - List plugins = apiPluginService.addApiPlugin(file); - plugins.forEach(this::addPlugin); - // 存入MinIO - if (CollectionUtils.isNotEmpty(plugins)) { - String pluginId = plugins.get(0).getPluginId(); - FileRequest request = getRequest(pluginId); - fileManagerService.upload(file, request); + try { + if (StringUtils.equalsIgnoreCase(scenario, PluginScenario.platform.name())) { + PluginWithBLOBs plugin = platformPluginService.addPlatformPlugin(file); + platformPluginService.notifiedPlatformPluginAdd(plugin.getId()); + } else { + List plugins = apiPluginService.addApiPlugin(file); + plugins.forEach(this::addPlugin); + // 存入MinIO + if (CollectionUtils.isNotEmpty(plugins)) { + String pluginId = plugins.get(0).getPluginId(); + FileRequest request = getRequest(pluginId); + fileManagerService.upload(file, request); + } else { + MSException.throwException(Translator.get("plugin_parse_error")); + } } + } catch (Exception ex) { + MSException.throwException(Translator.get("plugin_parse_error")); } + } private FileRequest getRequest(String pluginId) { diff --git a/system-setting/backend/src/main/resources/i18n/messages_en_US.properties b/system-setting/backend/src/main/resources/i18n/messages_en_US.properties index bbce8df8aa..fd0a198d27 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_en_US.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_en_US.properties @@ -2,4 +2,5 @@ error_lang_invalid=Invalid language parameter, new read_permission_file_fail=Failed to read permission file! platform_plugin_not_exit=Platform docking function has been plug-in, please download the corresponding version of the plug-in: workspace_name_exceeds_length_limit=Workspace name exceeds length limit -platform_plugin_exit=plugin is already exist! \ No newline at end of file +platform_plugin_exit=plugin is already exist! +plugin_parse_error=Plugin parse error \ No newline at end of file diff --git a/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties b/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties index ba6e80f19f..ca8a37a151 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -2,4 +2,5 @@ error_lang_invalid=语言参数错误, 新 read_permission_file_fail=读取权限文件失败! platform_plugin_not_exit=平台对接功能已插件化,请下载对应版本的插件: workspace_name_exceeds_length_limit=工作空间名称超出长度限制 -platform_plugin_exit=插件已存在! \ No newline at end of file +platform_plugin_exit=插件已存在! +plugin_parse_error=插件解析失败 \ No newline at end of file diff --git a/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties b/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties index 782c4064b5..c41c3e72b7 100644 --- a/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/system-setting/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -2,4 +2,5 @@ error_lang_invalid=語言參數錯誤,新 read_permission_file_fail=讀取權限文件失敗! platform_plugin_not_exit=平臺對接功能已插件化,請下載對應版本的插件: workspace_name_exceeds_length_limit=工作空間名稱超出長度限制 -platform_plugin_exit=插件已存在! \ No newline at end of file +platform_plugin_exit=插件已存在! +plugin_parse_error=插件解析失敗! \ No newline at end of file