mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-05-06 06:37:49 +08:00
better error messages
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@31 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
parent
60c17068a6
commit
2ccc098882
@ -111,6 +111,10 @@ func writeJson(w http.ResponseWriter, r *http.Request, obj interface{}) {
|
|||||||
func parseURLPath(path string) (vid, fid, ext string) {
|
func parseURLPath(path string) (vid, fid, ext string) {
|
||||||
sepIndex := strings.LastIndex(path, "/")
|
sepIndex := strings.LastIndex(path, "/")
|
||||||
commaIndex := strings.LastIndex(path[sepIndex:], ",")
|
commaIndex := strings.LastIndex(path[sepIndex:], ",")
|
||||||
|
if commaIndex <= 0 {
|
||||||
|
log.Println("unknown file id", path[sepIndex+1:])
|
||||||
|
return
|
||||||
|
}
|
||||||
dotIndex := strings.LastIndex(path[sepIndex:], ".")
|
dotIndex := strings.LastIndex(path[sepIndex:], ".")
|
||||||
vid = path[sepIndex+1 : commaIndex]
|
vid = path[sepIndex+1 : commaIndex]
|
||||||
fid = path[commaIndex+1:]
|
fid = path[commaIndex+1:]
|
||||||
@ -119,10 +123,6 @@ func parseURLPath(path string) (vid, fid, ext string) {
|
|||||||
fid = path[commaIndex+1 : dotIndex]
|
fid = path[commaIndex+1 : dotIndex]
|
||||||
ext = path[dotIndex+1:]
|
ext = path[dotIndex+1:]
|
||||||
}
|
}
|
||||||
if commaIndex <= 0 {
|
|
||||||
log.Println("unknown file id", path[sepIndex+1:commaIndex])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user