fix: Ignore absolute path when RepoUrl is provided

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Co-authored-by: Mohammad Forutan <mforutan@users.noreply.github.com>
pull/31307/head
Terry Howe 7 days ago
parent 6717ea5e3c
commit 9c7bf37c6f
No known key found for this signature in database

@ -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. // This does not ensure that the chart is well-formed; only that the requested filename exists.
// //
// Order of resolution: // 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 // - if path is absolute or begins with '.', error out here
// - URL // - URL
// //
@ -841,20 +841,22 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
name = strings.TrimSpace(name) name = strings.TrimSpace(name)
version := strings.TrimSpace(c.Version) version := strings.TrimSpace(c.Version)
if _, err := os.Stat(name); err == nil { if c.RepoURL == "" {
abs, err := filepath.Abs(name) if _, err := os.Stat(name); err == nil {
if err != nil { abs, err := filepath.Abs(name)
return abs, err if err != nil {
} return abs, err
if c.Verify {
if _, err := downloader.VerifyChart(abs, abs+".prov", c.Keyring); err != nil {
return "", 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{ dl := downloader.ChartDownloader{

Loading…
Cancel
Save