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/weed/volume.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/weed/volume.go')
| -rw-r--r-- | go/weed/volume.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/go/weed/volume.go b/go/weed/volume.go index 3c4db7ff1..cf58af799 100644 --- a/go/weed/volume.go +++ b/go/weed/volume.go @@ -118,7 +118,7 @@ func storeHandler(w http.ResponseWriter, r *http.Request) { } func GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) { n := new(storage.Needle) - vid, fid, filename, ext := parseURLPath(r.URL.Path) + vid, fid, filename, ext, _ := parseURLPath(r.URL.Path) volumeId, err := storage.NewVolumeId(vid) if err != nil { debug("parsing error:", err, r.URL.Path) @@ -207,7 +207,7 @@ func PostHandler(w http.ResponseWriter, r *http.Request) { writeJsonError(w, r, e) return } - vid, _, _, _ := parseURLPath(r.URL.Path) + vid, _, _, _, _ := parseURLPath(r.URL.Path) volumeId, ve := storage.NewVolumeId(vid) if ve != nil { debug("NewVolumeId error:", ve) @@ -231,7 +231,7 @@ func PostHandler(w http.ResponseWriter, r *http.Request) { } func DeleteHandler(w http.ResponseWriter, r *http.Request) { n := new(storage.Needle) - vid, fid, _, _ := parseURLPath(r.URL.Path) + vid, fid, _, _, _ := parseURLPath(r.URL.Path) volumeId, _ := storage.NewVolumeId(vid) n.ParsePath(fid) @@ -266,7 +266,7 @@ func DeleteHandler(w http.ResponseWriter, r *http.Request) { writeJsonQuiet(w, r, m) } -func parseURLPath(path string) (vid, fid, filename, ext string) { +func parseURLPath(path string) (vid, fid, filename, ext string, isVolumeIdOnly bool) { switch strings.Count(path, "/") { case 3: parts := strings.Split(path, "/") @@ -284,9 +284,7 @@ func parseURLPath(path string) (vid, fid, filename, ext string) { sepIndex := strings.LastIndex(path, "/") commaIndex := strings.LastIndex(path[sepIndex:], ",") if commaIndex <= 0 { - if "favicon.ico" != path[sepIndex+1:] { - glog.V(0).Infoln("unknown file id", path[sepIndex+1:]) - } + vid, isVolumeIdOnly = path[sepIndex+1:], true return } dotIndex := strings.LastIndex(path[sepIndex:], ".") |
