Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

better error messages

[email protected]2ccc098882c9
diff --git a/weed-fs/src/cmd/weedc.go b/weed-fs/src/cmd/weedc.go
index 6d40b9586d..56cbf9e86d 100644
--- a/weed-fs/src/cmd/weedc.go
+++ b/weed-fs/src/cmd/weedc.go
@@ -111,6 +111,10 @@ func writeJson(w http.ResponseWriter, r *http.Request, obj interface{}) {
func parseURLPath(path string) (vid, fid, ext string) {
sepIndex := strings.LastIndex(path, "/")
commaIndex := strings.LastIndex(path[sepIndex:], ",")
+ if commaIndex <= 0 {
+ log.Println("unknown file id", path[sepIndex+1:])
+ return
+ }
dotIndex := strings.LastIndex(path[sepIndex:], ".")
vid = path[sepIndex+1 : commaIndex]
fid = path[commaIndex+1:]
@@ -119,10 +123,6 @@ func parseURLPath(path string) (vid, fid, ext string) {
fid = path[commaIndex+1 : dotIndex]
ext = path[dotIndex+1:]
}
- if commaIndex <= 0 {
- log.Println("unknown file id", path[sepIndex+1:commaIndex])
- return
- }
return
}