mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-18 19:39:23 +08:00
better detect file mime type
This commit is contained in:
@@ -77,6 +77,12 @@ func doUploadData(uploadUrl string, filename string, cipher bool, data []byte, i
|
||||
contentIsGzipped := isInputGzipped
|
||||
shouldGzipNow := false
|
||||
if !isInputGzipped {
|
||||
if mtype == "" {
|
||||
mtype = http.DetectContentType(data)
|
||||
if mtype == "application/octet-stream" {
|
||||
mtype = ""
|
||||
}
|
||||
}
|
||||
if shouldBeZipped, iAmSure := util.IsGzippableFileType(filepath.Base(filename), mtype); iAmSure && shouldBeZipped {
|
||||
shouldGzipNow = true
|
||||
} else if !iAmSure && mtype == "" && len(data) > 128 {
|
||||
|
Reference in New Issue
Block a user