فهرست منبع

add errorhandling to deletePlugin function

NaokiHigashi28 1 سال پیش
والد
کامیت
71bef31d72
1فایلهای تغییر یافته به همراه9 افزوده شده و 1 حذف شده
  1. 9 1
      apps/app/src/features/growi-plugin/server/services/growi-plugin/growi-plugin.ts

+ 9 - 1
apps/app/src/features/growi-plugin/server/services/growi-plugin/growi-plugin.ts

@@ -315,8 +315,16 @@ export class GrowiPluginService implements IGrowiPluginService {
       throw new Error('No plugin found for this ID.');
     }
 
+    let growiPluginsPath: fs.PathLike | undefined;
+    try {
+      growiPluginsPath = this.joinAndValidatePath(PLUGIN_STORING_PATH, growiPlugins.installedPath);
+    }
+    catch (err) {
+      logger.error(err);
+      throw new Error('Failed to constract plugin path');
+    }
+
     try {
-      const growiPluginsPath = path.join(PLUGIN_STORING_PATH, growiPlugins.installedPath);
       await deleteFolder(growiPluginsPath);
     }
     catch (err) {