mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adding compressiong support!
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@60 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
parent
f3a4125ee7
commit
50c3f1d4a7
|
@ -5,7 +5,7 @@ import (
|
|||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"mime"
|
||||
"mime"
|
||||
"net/http"
|
||||
"os"
|
||||
"pkg/util"
|
||||
|
@ -32,17 +32,17 @@ func NewNeedle(r *http.Request) (n *Needle, e error) {
|
|||
return
|
||||
}
|
||||
part, _ := form.NextPart()
|
||||
fname := part.FileName()
|
||||
data, _ := ioutil.ReadAll(part)
|
||||
//log.Println("uploading file " + part.FileName())
|
||||
dotIndex := strings.LastIndex(fname, ".")
|
||||
if dotIndex > 0 {
|
||||
ext := fname[dotIndex:]
|
||||
mtype := mime.TypeByExtension(ext)
|
||||
if IsCompressable(ext, mtype){
|
||||
data = GzipData(data)
|
||||
}
|
||||
}
|
||||
fname := part.FileName()
|
||||
data, _ := ioutil.ReadAll(part)
|
||||
//log.Println("uploading file " + part.FileName())
|
||||
dotIndex := strings.LastIndex(fname, ".")
|
||||
if dotIndex > 0 {
|
||||
ext := fname[dotIndex:]
|
||||
mtype := mime.TypeByExtension(ext)
|
||||
if IsCompressable(ext, mtype) {
|
||||
data = GzipData(data)
|
||||
}
|
||||
}
|
||||
n.Data = data
|
||||
|
||||
commaSep := strings.LastIndex(r.URL.Path, ",")
|
||||
|
|
Loading…
Reference in a new issue