Fix: Do not crash if plugin folder mismatches plugin identifier

This commit is contained in:
Kukks
2021-04-20 08:38:37 +02:00
parent 0554565b30
commit 1ada87ca31

View File

@@ -83,13 +83,20 @@ namespace BTCPayServer.Plugins
foreach (var dir in orderedDirs) foreach (var dir in orderedDirs)
{ {
var pluginName = Path.GetFileName(dir); var pluginName = Path.GetFileName(dir);
var pluginFilePath = Path.Combine(dir, pluginName + ".dll");
if (disabledPlugins.Contains(pluginName)) if (disabledPlugins.Contains(pluginName))
{ {
continue; continue;
} }
if (!File.Exists(pluginFilePath))
{
_logger.LogError(
$"Error when loading plugin {pluginName} - {pluginFilePath} does not exist");
continue;
}
var plugin = PluginLoader.CreateFromAssemblyFile( 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 => config =>
{ {