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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
avoid reparsing the multipart form
Chris Lu4d322df95ecd
diff --git a/weed/storage/needle.go b/weed/storage/needle.goindex f67556c72a..e071ebbd5c 100644--- a/weed/storage/needle.go+++ b/weed/storage/needle.go@@ -29,12 +29,12 @@ type Needle struct {DataSize uint32 `comment:"Data size"` //version2Data []byte `comment:"The actual file data"`- Flags byte `comment:"boolean flags"` //version2- NameSize uint8 //version2+ Flags byte `comment:"boolean flags"` //version2+ NameSize uint8 //version2Name []byte `comment:"maximum 256 characters"` //version2- MimeSize uint8 //version2+ MimeSize uint8 //version2Mime []byte `comment:"maximum 256 characters"` //version2- PairsSize uint16 //version2+ PairsSize uint16 //version2Pairs []byte `comment:"additional name value pairs, json format, maximum 64kB"`LastModified uint64 //only store LastModifiedBytesLength bytes, which is 5 bytes to diskTtl *TTL@@ -59,10 +59,8 @@ func ParseUpload(r *http.Request) (}}- isChunkedFile, _ = strconv.ParseBool(r.FormValue("cm"))-if r.Method == "POST" {- fileName, data, mimeType, isGzipped, e = parseMultipart(r, isChunkedFile)+ fileName, data, mimeType, isGzipped, isChunkedFile, e = parseMultipart(r)} else {isGzipped = falsemimeType = r.Header.Get("Content-Type")diff --git a/weed/storage/needle_parse_multipart.go b/weed/storage/needle_parse_multipart.goindex af12b994df..de60f4e753 100644--- a/weed/storage/needle_parse_multipart.go+++ b/weed/storage/needle_parse_multipart.go@@ -8,10 +8,11 @@ import ("net/http""path""strings"+ "strconv")-func parseMultipart(r *http.Request, isChunkedFile bool) (- fileName string, data []byte, mimeType string, isGzipped bool, e error) {+func parseMultipart(r *http.Request) (+ fileName string, data []byte, mimeType string, isGzipped, isChunkedFile bool, e error) {form, fe := r.MultipartReader()if fe != nil {glog.V(0).Infoln("MultipartReader [ERROR]", fe)@@ -63,6 +64,8 @@ func parseMultipart(r *http.Request, isChunkedFile bool) (}}+ isChunkedFile, _ = strconv.ParseBool(r.FormValue("cm"))+if !isChunkedFile {dotIndex := strings.LastIndex(fileName, ".")