Skip to content

Commit 361a0df

Browse files
Fix handling of empty 'urlsToWatch' in plugins (#533)
* When plugin defines an empty array of URLs to watch, use the global one #527 * Refactor plugin registration on line 55 to check for both null and non-empty 'pluginUrls'. This ensures proper handling of empty plugin URL arrays and aligns with the requirement outlined in the issue. Updated the 'Register' method call to conditionally use 'pluginUrls' or default to 'defaultUrlsToWatch' based on the not null and not empty check. #528 * Fix handling of empty 'urlsToWatch' in plugins This commit addresses the issue where plugins defining an empty array for 'urlsToWatch' would result in the plugin being disabled. The code has been modified to check for both null and empty arrays, and in both cases, it now defaults to using the global list of URLs. This ensures that plugins remain active even when no specific URLs are provided. * Update dev-proxy/PluginLoader.cs --------- Co-authored-by: Waldek Mastykarz <[email protected]>
1 parent a6d0662 commit 361a0df

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dev-proxy/PluginLoader.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ public PluginLoaderResult LoadPlugins(IPluginEvents pluginEvents, IProxyContext
5252
}
5353
// Load Plugins from assembly
5454
IProxyPlugin plugin = CreatePlugin(assembly, h);
55-
plugin.Register(pluginEvents, proxyContext, pluginUrls ?? defaultUrlsToWatch, h.ConfigSection is null ? null : Configuration.GetSection(h.ConfigSection));
55+
plugin.Register(
56+
pluginEvents,
57+
proxyContext,
58+
(pluginUrls != null && pluginUrls.Any()) ? pluginUrls : defaultUrlsToWatch,
59+
h.ConfigSection is null ? null : Configuration.GetSection(h.ConfigSection)
60+
);
5661
plugins.Add(plugin);
5762
}
5863
}

0 commit comments

Comments
 (0)