From 9c7bf37c6fd6cadaf45803e6898166db3c7689e5 Mon Sep 17 00:00:00 2001 From: Terry Howe Date: Thu, 18 Sep 2025 13:18:27 -0600 Subject: [PATCH] fix: Ignore absolute path when RepoUrl is provided Signed-off-by: Terry Howe Co-authored-by: Mohammad Forutan --- pkg/action/install.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index c6d4f723c..404ec46a6 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -828,7 +828,7 @@ func urlEqual(u1, u2 *url.URL) bool { // This does not ensure that the chart is well-formed; only that the requested filename exists. // // Order of resolution: -// - relative to current working directory +// - relative to current working directory when --repo flag is not presented // - if path is absolute or begins with '.', error out here // - URL // @@ -841,20 +841,22 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) ( name = strings.TrimSpace(name) version := strings.TrimSpace(c.Version) - if _, err := os.Stat(name); err == nil { - abs, err := filepath.Abs(name) - if err != nil { - return abs, err - } - if c.Verify { - if _, err := downloader.VerifyChart(abs, abs+".prov", c.Keyring); err != nil { - return "", err + if c.RepoURL == "" { + if _, err := os.Stat(name); err == nil { + abs, err := filepath.Abs(name) + if err != nil { + return abs, err } + if c.Verify { + if _, err := downloader.VerifyChart(abs, abs+".prov", c.Keyring); err != nil { + return "", err + } + } + return abs, nil + } + if filepath.IsAbs(name) || strings.HasPrefix(name, ".") { + return name, fmt.Errorf("path %q not found", name) } - return abs, nil - } - if filepath.IsAbs(name) || strings.HasPrefix(name, ".") { - return name, fmt.Errorf("path %q not found", name) } dl := downloader.ChartDownloader{