From bd017324eb6c731eb481646fd5724f4502a9c700 Mon Sep 17 00:00:00 2001 From: Yuhui Luo <92632263+lyh7c00@users.noreply.github.com> Date: Tue, 25 Aug 2026 20:58:26 +0800 Subject: [PATCH] fix(plugin): skip empty entries when resolving plugins dir Guard against leading/trailing/duplicate list separators in HELM_PLUGINS so pluginsDir never resolves to an empty path. Signed-off-by: Yuhui Luo <92632263+lyh7c00@users.noreply.github.com> --- internal/plugin/installer/base.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/plugin/installer/base.go b/internal/plugin/installer/base.go index 2e4c16f4a..361abff05 100644 --- a/internal/plugin/installer/base.go +++ b/internal/plugin/installer/base.go @@ -40,11 +40,12 @@ func newBase(source string) base { // HELM_PLUGINS contains a list of directories (separated by the OS path list // separator), the first directory is the default install target. func (b *base) pluginsDir() string { - dirs := filepath.SplitList(b.PluginsDirectory) - if len(dirs) == 0 { - return b.PluginsDirectory + for _, dir := range filepath.SplitList(b.PluginsDirectory) { + if dir != "" { + return dir + } } - return dirs[0] + return b.PluginsDirectory } // Path is where the plugin will be installed.