From a6bb509cb741a41da605537014cde037a8e16a36 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 18 Oct 2021 10:47:39 -0700 Subject: [PATCH] adjust mime detection --- weed/s3api/s3api_object_handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/weed/s3api/s3api_object_handlers.go b/weed/s3api/s3api_object_handlers.go index 296501516..e5513a703 100644 --- a/weed/s3api/s3api_object_handlers.go +++ b/weed/s3api/s3api_object_handlers.go @@ -41,7 +41,7 @@ func mimeDetect(r *http.Request, dataReader io.Reader) io.ReadCloser { mimeBuffer := make([]byte, 512) size, _ := dataReader.Read(mimeBuffer) 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(dataReader)