Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

ensure mime type checking by lower cased file name extension

Chris Ludb46565d1800
diff --git a/go/operation/upload_content.go b/go/operation/upload_content.go
index 3b7fcf0081..bfe2dd69bd 100644
--- a/go/operation/upload_content.go
+++ b/go/operation/upload_content.go
@@ -13,6 +13,7 @@ import (
"net/http"
"net/textproto"
"path/filepath"
+ "strings"
)
type UploadResult struct {
@@ -25,7 +26,7 @@ func Upload(uploadUrl string, filename string, reader io.Reader) (*UploadResult,
body_writer := multipart.NewWriter(body_buf)
h := make(textproto.MIMEHeader)
h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, filename))
- h.Set("Content-Type", mime.TypeByExtension(filepath.Ext(filename)))
+ h.Set("Content-Type", mime.TypeByExtension(strings.ToLower(filepath.Ext(filename))))
file_writer, err := body_writer.CreatePart(h)
if err != nil {
log.Println("error creating form file", err)