X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fplugins%2Fplugin-manager.ts;h=9086a4c8e855b2343fb77ddb9f49262bd001a81b;hb=f86ff3a02642263ac64db5d5fba4059db0092561;hp=ca72753663541507cf2329912dedcbfaff934190;hpb=841ddf8886f87ee694b604d2d0948326a6f9b4bb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index ca7275366..9086a4c8e 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -370,15 +370,17 @@ export class PluginManager implements ServerHook { } catch (rootErr) { logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr }) - try { - await this.uninstall({ npmName }) - } catch (err) { - logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err }) - + if (npmName) { try { - await removeNpmPlugin(npmName) + await this.uninstall({ npmName }) } catch (err) { - logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) + logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err }) + + try { + await removeNpmPlugin(npmName) + } catch (err) { + logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) + } } } @@ -410,7 +412,7 @@ export class PluginManager implements ServerHook { npmName: string unregister?: boolean // default true }) { - const { npmName, unregister } = options + const { npmName, unregister = true } = options logger.info('Uninstalling plugin %s.', npmName)