fix(chartutil): fix Expand function

This ensures that all necessary directories
get created when expanding a chart in the
chartutil.Expand function. fixes #892
pull/896/head
Michelle Noorali 9 years ago
parent 5cd8f4d047
commit bcffe8a3f2

@ -40,6 +40,16 @@ func Expand(dir string, r io.Reader) error {
return err return err
} }
//split header name and create missing directories
d, _ := filepath.Split(header.Name)
fullDir := filepath.Join(dir, d)
_, err = os.Stat(fullDir)
if err != nil && d != "" {
if err := os.MkdirAll(fullDir, 0700); err != nil {
return err
}
}
path := filepath.Clean(filepath.Join(dir, header.Name)) path := filepath.Clean(filepath.Join(dir, header.Name))
info := header.FileInfo() info := header.FileInfo()
if info.IsDir() { if info.IsDir() {

Loading…
Cancel
Save