mimee type default "application/octet-stream" to empty string

This commit is contained in:
Chris Lu
2020-03-07 06:07:56 -08:00
parent dba35404e4
commit 8c3e25b38a

View File

@@ -493,9 +493,12 @@ func detectMimeType(f *os.File) string {
}
if err != nil {
fmt.Printf("read head of %v: %v\n", f.Name(), err)
return "application/octet-stream"
return ""
}
f.Seek(0, io.SeekStart)
mimeType := http.DetectContentType(head[:n])
if mimeType == "application/octet-stream" {
return ""
}
return mimeType
}