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 1 week 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,6 +841,7 @@ 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 c.RepoURL == "" {
if _, err := os.Stat(name); err == nil { if _, err := os.Stat(name); err == nil {
abs, err := filepath.Abs(name) abs, err := filepath.Abs(name)
if err != nil { if err != nil {
@ -856,6 +857,7 @@ func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (
if filepath.IsAbs(name) || strings.HasPrefix(name, ".") { if filepath.IsAbs(name) || strings.HasPrefix(name, ".") {
return name, fmt.Errorf("path %q not found", name) return name, fmt.Errorf("path %q not found", name)
} }
}
dl := downloader.ChartDownloader{ dl := downloader.ChartDownloader{
Out: os.Stdout, Out: os.Stdout,

Loading…
Cancel
Save