aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2017-01-08 10:35:47 -0800
committerChris Lu <chris.lu@gmail.com>2017-01-08 10:35:47 -0800
commit7b6837cbc2b2c27b6acdc2c41d88cd27d0823e60 (patch)
treec16d1ccac90d1e5c011347bfd7dae72b6bc6e8d1
parentb14332df96c5a51b5d21730d74b06ccb379b2657 (diff)
downloadseaweedfs-7b6837cbc2b2c27b6acdc2c41d88cd27d0823e60.tar.xz
seaweedfs-7b6837cbc2b2c27b6acdc2c41d88cd27d0823e60.zip
move back the section
-rw-r--r--weed/storage/needle.go24
1 files changed, 13 insertions, 11 deletions
diff --git a/weed/storage/needle.go b/weed/storage/needle.go
index 5bafe2f62..82ba2fb6a 100644
--- a/weed/storage/needle.go
+++ b/weed/storage/needle.go
@@ -120,19 +120,21 @@ func ParseUpload(r *http.Request) (
}
isChunkedFile, _ = strconv.ParseBool(r.FormValue("cm"))
- dotIndex := strings.LastIndex(fileName, ".")
- ext, mtype := "", ""
- if dotIndex > 0 {
- ext = strings.ToLower(fileName[dotIndex:])
- mtype = mime.TypeByExtension(ext)
- }
- contentType := part.Header.Get("Content-Type")
- if contentType != "" && mtype != contentType {
- mimeType = contentType //only return mime type if not deductable
- mtype = contentType
- }
if !isChunkedFile {
+
+ dotIndex := strings.LastIndex(fileName, ".")
+ ext, mtype := "", ""
+ if dotIndex > 0 {
+ ext = strings.ToLower(fileName[dotIndex:])
+ mtype = mime.TypeByExtension(ext)
+ }
+ contentType := part.Header.Get("Content-Type")
+ if contentType != "" && mtype != contentType {
+ mimeType = contentType //only return mime type if not deductable
+ mtype = contentType
+ }
+
if part.Header.Get("Content-Encoding") == "gzip" {
isGzipped = true
} else if operation.IsGzippable(ext, mtype) {