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
@@ -85,7 +85,10 @@ func ensureArchive(name string, raw *os.File) error {
|
||||
if err != nil && err != io.EOF {
|
||||
return fmt.Errorf("file '%s' cannot be read: %s", name, err)
|
||||
}
|
||||
if contentType := http.DetectContentType(buffer); contentType != "application/x-gzip" {
|
||||
|
||||
// Helm may identify achieve of the application/x-gzip as application/vnd.ms-fontobject.
|
||||
// Fix for: https://github.com/helm/helm/issues/12261
|
||||
if contentType := http.DetectContentType(buffer); contentType != "application/x-gzip" && !isGZipApplication(buffer) {
|
||||
// TODO: Is there a way to reliably test if a file content is YAML? ghodss/yaml accepts a wide
|
||||
// variety of content (Makefile, .zshrc) as valid YAML without errors.
|
||||
|
||||
@@ -98,6 +101,12 @@ func ensureArchive(name string, raw *os.File) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// isGZipApplication checks whether the achieve is of the application/x-gzip type.
|
||||
func isGZipApplication(data []byte) bool {
|
||||
sig := []byte("\x1F\x8B\x08")
|
||||
return bytes.HasPrefix(data, sig)
|
||||
}
|
||||
|
||||
// LoadArchiveFiles reads in files out of an archive into memory. This function
|
||||
// performs important path security checks and should always be used before
|
||||
// expanding a tarball
|
||||
|
||||
Reference in New Issue
Block a user