mirror of https://github.com/stashapp/stash.git
Fix ffmpeg download (#2416)
This commit is contained in:
parent
627c1e9c60
commit
ba41133745
|
@ -124,10 +124,16 @@ func downloadSingle(ctx context.Context, configDirectory, url string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logger.Info("Downloading complete")
|
||||
|
||||
if resp.Header.Get("Content-Type") == "application/zip" {
|
||||
mime := resp.Header.Get("Content-Type")
|
||||
if mime != "application/zip" { // try detecting MIME type since some servers don't return the correct one
|
||||
data := make([]byte, 500) // http.DetectContentType only reads up to 500 bytes
|
||||
_, _ = out.ReadAt(data, 0)
|
||||
mime = http.DetectContentType(data)
|
||||
}
|
||||
|
||||
if mime == "application/zip" {
|
||||
logger.Infof("Unzipping %s...", archivePath)
|
||||
if err := unzip(archivePath, configDirectory); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue