From 61338eedb78fbdf3457ffddd9666297e048acaf6 Mon Sep 17 00:00:00 2001 From: chenos Date: Thu, 9 May 2024 14:06:43 +0800 Subject: [PATCH] fix(server): parse plugin name --- .../server/src/plugin-manager/plugin-manager.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/core/server/src/plugin-manager/plugin-manager.ts b/packages/core/server/src/plugin-manager/plugin-manager.ts index b309b1dacf..a126ae75b9 100644 --- a/packages/core/server/src/plugin-manager/plugin-manager.ts +++ b/packages/core/server/src/plugin-manager/plugin-manager.ts @@ -307,22 +307,17 @@ export class PluginManager { return; } this.app.log.info('attempt to add the plugin to the app'); - let packageName: string; - try { - packageName = await PluginManager.getPackageName(pluginName); - } catch (error) { - packageName = pluginName; - } + const { name, packageName } = await PluginManager.parseName(pluginName); const json = await PluginManager.getPackageJson(packageName); this.app.log.info(`add plugin [${packageName}]`, { - name: pluginName, - packageName: packageName, + name, + packageName, version: json.version, }); await this.repository.updateOrCreate({ values: { - name: pluginName, - packageName: packageName, + name, + packageName, version: json.version, }, filterKeys: ['name'],