refactored installer.go

Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
pull/13225/head
Suleiman Dibirov 1 year ago
parent 1f3b4cfa04
commit 874d3dea92

@ -105,21 +105,22 @@ func isRemoteHTTPArchive(source string) bool {
// Next, we look for the content type or content disposition headers to see // Next, we look for the content type or content disposition headers to see
// if they have matching extractors. // if they have matching extractors.
contentType := res.Header.Get("content-type") contentType := res.Header.Get("content-type")
foundSuffix, ok := mediaTypeToExtension(contentType) var foundSuffix string
if !ok {
if strings.HasSuffix(source, ".tar.gz") && contentType == "application/octet-stream" { if contentType == "application/octet-stream" {
foundSuffix = ".tar.gz" foundSuffix = filepath.Ext(source)
} else { } else {
// Media type not recognized foundSuffix, _ = mediaTypeToExtension(contentType)
return false
}
} }
for suffix := range Extractors { if foundSuffix == "" {
if strings.HasSuffix(foundSuffix, suffix) { // Media type not recognized
return true return false
}
} }
_, ok := Extractors[foundSuffix]
return ok
} }
return false return false
} }

Loading…
Cancel
Save