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>
pull/32569/head
Yuhui Luo 1 month ago committed by GitHub
parent 5926d700ec
commit bd017324eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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.

Loading…
Cancel
Save