diff options
| author | chris.lu@gmail.com <chris.lu@gmail.com@282b0af5-e82d-9cf1-ede4-77906d7719d0> | 2012-07-30 08:37:10 +0000 |
|---|---|---|
| committer | chris.lu@gmail.com <chris.lu@gmail.com@282b0af5-e82d-9cf1-ede4-77906d7719d0> | 2012-07-30 08:37:10 +0000 |
| commit | 50c3f1d4a71f750d7b019a7efb6042071fba31d7 (patch) | |
| tree | c6e9ac985056083dcb6889d94fd5f42a3d12a9b4 /weed-fs/src | |
| parent | f3a4125ee79b103df70f1850776639a51ac572cd (diff) | |
| download | seaweedfs-50c3f1d4a71f750d7b019a7efb6042071fba31d7.tar.xz seaweedfs-50c3f1d4a71f750d7b019a7efb6042071fba31d7.zip | |
adding compressiong support!
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@60 282b0af5-e82d-9cf1-ede4-77906d7719d0
Diffstat (limited to 'weed-fs/src')
| -rw-r--r-- | weed-fs/src/pkg/storage/needle.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/weed-fs/src/pkg/storage/needle.go b/weed-fs/src/pkg/storage/needle.go index b0d499c05..6396b8ef0 100644 --- a/weed-fs/src/pkg/storage/needle.go +++ b/weed-fs/src/pkg/storage/needle.go @@ -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, ",") |
