fix: absolute chart path (#753)

Resolves #743
This commit is contained in:
KUOKA Yusuke
2019-07-12 22:37:54 +09:00
committed by GitHub
parent 4166b418c9
commit b2a6231dcf
4 changed files with 88 additions and 10 deletions
+12
View File
@@ -1,6 +1,7 @@
package state
import (
"path/filepath"
"regexp"
"strings"
)
@@ -38,3 +39,14 @@ func resolveRemoteChart(repoAndChart string) (string, string, bool) {
return repo, chart, true
}
// normalizeChart allows for the distinction between a file path reference and repository references.
// - Any single (or double character) followed by a `/` will be considered a local file reference and
// be constructed relative to the `base path`.
// - Everything else is assumed to be an absolute path or an actual <repository>/<chart> reference.
func normalizeChart(basePath, chart string) string {
if !isLocalChart(chart) || chart[0] == '/' {
return chart
}
return filepath.Join(basePath, chart)
}