From 1ada87ca312aa853b2442b19edad48e4766e02c9 Mon Sep 17 00:00:00 2001 From: Kukks Date: Tue, 20 Apr 2021 08:38:37 +0200 Subject: [PATCH] Fix: Do not crash if plugin folder mismatches plugin identifier --- BTCPayServer/Plugins/PluginManager.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Plugins/PluginManager.cs b/BTCPayServer/Plugins/PluginManager.cs index d5b242d87..e098960a3 100644 --- a/BTCPayServer/Plugins/PluginManager.cs +++ b/BTCPayServer/Plugins/PluginManager.cs @@ -83,13 +83,20 @@ namespace BTCPayServer.Plugins foreach (var dir in orderedDirs) { var pluginName = Path.GetFileName(dir); + var pluginFilePath = Path.Combine(dir, pluginName + ".dll"); if (disabledPlugins.Contains(pluginName)) { continue; } - + if (!File.Exists(pluginFilePath)) + { + _logger.LogError( + $"Error when loading plugin {pluginName} - {pluginFilePath} does not exist"); + continue; + } + var plugin = PluginLoader.CreateFromAssemblyFile( - Path.Combine(dir, pluginName + ".dll"), // create a plugin from for the .dll file + pluginFilePath, // create a plugin from for the .dll file config => {