diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-09-01 23:58:21 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-09-01 23:58:21 -0700 |
| commit | 82b74c7940d958c4244cbc67d495b8156a17d2b3 (patch) | |
| tree | 69c0fcee0f49e027a1f2bc0c9d012b2e4328475a /go/storage/needle.go | |
| parent | 2e70cc8be77d0047139ea56864df74477387f2f3 (diff) | |
| download | seaweedfs-82b74c7940d958c4244cbc67d495b8156a17d2b3.tar.xz seaweedfs-82b74c7940d958c4244cbc67d495b8156a17d2b3.zip | |
issue 43 "go fmt" chagnes from "Ryan S. Brown" <sb@ryansb.com>
some basic changes to parse upload url
Diffstat (limited to 'go/storage/needle.go')
| -rw-r--r-- | go/storage/needle.go | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/go/storage/needle.go b/go/storage/needle.go index 54799df4e..e23f4e67b 100644 --- a/go/storage/needle.go +++ b/go/storage/needle.go @@ -1,10 +1,10 @@ package storage import ( + "code.google.com/p/weed-fs/go/glog" "code.google.com/p/weed-fs/go/util" "encoding/hex" "io/ioutil" - "code.google.com/p/weed-fs/go/glog" "mime" "net/http" "path" @@ -86,19 +86,19 @@ func ParseUpload(r *http.Request) (fileName string, data []byte, mimeType string fileName = fileName[:len(fileName)-3] } modifiedTime, _ = strconv.ParseUint(r.FormValue("ts"), 10, 64) - return + return } func NewNeedle(r *http.Request) (n *Needle, e error) { - fname, mimeType, isGzipped := "", "", false + fname, mimeType, isGzipped := "", "", false n = new(Needle) fname, n.Data, mimeType, isGzipped, n.LastModified, e = ParseUpload(r) if e != nil { - return + return + } + if len(fname) < 256 { + n.Name = []byte(fname) + n.SetHasName() } - if len(fname) < 256 { - n.Name = []byte(fname) - n.SetHasName() - } if len(mimeType) < 256 { n.Mime = []byte(mimeType) n.SetHasMime() @@ -108,7 +108,7 @@ func NewNeedle(r *http.Request) (n *Needle, e error) { } if n.LastModified == 0 { n.LastModified = uint64(time.Now().Unix()) - n.SetHasLastModifiedDate() + n.SetHasLastModifiedDate() } n.Checksum = NewCRC(n.Data) @@ -127,9 +127,6 @@ func NewNeedle(r *http.Request) (n *Needle, e error) { func (n *Needle) ParsePath(fid string) { length := len(fid) if length <= 8 { - if length > 0 { - glog.V(0).Infoln("Invalid fid", fid, "length", length) - } return } delta := "" |
