chore: Fail fast for parts[0]

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
pull/9403/head
Josh Soref 5 years ago
parent 85794cfc6e
commit 585e6572bd

@ -139,6 +139,11 @@ func LoadArchiveFiles(in io.Reader) ([]*BufferedFile, error) {
}
parts := strings.Split(hd.Name, delimiter)
if parts[0] == "Chart.yaml" {
return nil, errors.New("chart yaml not in base directory")
}
n := strings.Join(parts[1:], delimiter)
// Normalize the path to the / delimiter
@ -165,10 +170,6 @@ func LoadArchiveFiles(in io.Reader) ([]*BufferedFile, error) {
return nil, errors.New("chart contains illegally named files")
}
if parts[0] == "Chart.yaml" {
return nil, errors.New("chart yaml not in base directory")
}
if _, err := io.Copy(b, tr); err != nil {
return nil, err
}

Loading…
Cancel
Save