mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adjust mime detection
This commit is contained in:
parent
825d76622b
commit
a6bb509cb7
|
@ -41,7 +41,7 @@ func mimeDetect(r *http.Request, dataReader io.Reader) io.ReadCloser {
|
||||||
mimeBuffer := make([]byte, 512)
|
mimeBuffer := make([]byte, 512)
|
||||||
size, _ := dataReader.Read(mimeBuffer)
|
size, _ := dataReader.Read(mimeBuffer)
|
||||||
if size > 0 {
|
if size > 0 {
|
||||||
r.Header.Set("Content-Type", http.DetectContentType(mimeBuffer))
|
r.Header.Set("Content-Type", http.DetectContentType(mimeBuffer[:size]))
|
||||||
return io.NopCloser(io.MultiReader(bytes.NewReader(mimeBuffer[:size]), dataReader))
|
return io.NopCloser(io.MultiReader(bytes.NewReader(mimeBuffer[:size]), dataReader))
|
||||||
}
|
}
|
||||||
return io.NopCloser(dataReader)
|
return io.NopCloser(dataReader)
|
||||||
|
|
Loading…
Reference in a new issue