feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> * feat: kubesphere 4.0 Signed-off-by: ci-bot <ci-bot@kubesphere.io> --------- Signed-off-by: ci-bot <ci-bot@kubesphere.io> Co-authored-by: ks-ci-bot <ks-ci-bot@example.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
committed by
GitHub
parent
b5015ec7b9
commit
447a51f08b
20
vendor/helm.sh/helm/v3/pkg/chartutil/save.go
vendored
20
vendor/helm.sh/helm/v3/pkg/chartutil/save.go
vendored
@@ -39,6 +39,10 @@ var headerBytes = []byte("+aHR0cHM6Ly95b3V0dS5iZS96OVV6MWljandyTQo=")
|
||||
// directory, writing the chart's contents to that subdirectory.
|
||||
func SaveDir(c *chart.Chart, dest string) error {
|
||||
// Create the chart directory
|
||||
err := validateName(c.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
outdir := filepath.Join(dest, c.Name())
|
||||
if fi, err := os.Stat(outdir); err == nil && !fi.IsDir() {
|
||||
return errors.Errorf("file %s already exists and is not a directory", outdir)
|
||||
@@ -149,6 +153,10 @@ func Save(c *chart.Chart, outDir string) (string, error) {
|
||||
}
|
||||
|
||||
func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error {
|
||||
err := validateName(c.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
base := filepath.Join(prefix, c.Name())
|
||||
|
||||
// Pull out the dependencies of a v1 Chart, since there's no way
|
||||
@@ -242,3 +250,15 @@ func writeToTar(out *tar.Writer, name string, body []byte) error {
|
||||
_, err := out.Write(body)
|
||||
return err
|
||||
}
|
||||
|
||||
// If the name has directory name has characters which would change the location
|
||||
// they need to be removed.
|
||||
func validateName(name string) error {
|
||||
nname := filepath.Base(name)
|
||||
|
||||
if nname != name {
|
||||
return ErrInvalidChartName{name}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user