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.

fix(volume): avoid panic when URL path has a dot before the comma (#9712)

Chris Luc3255b51fdc9
diff --git a/weed/storage/needle/needle.go b/weed/storage/needle/needle.go
index 7c0ce1c203..716ef99a78 100644
--- a/weed/storage/needle/needle.go
+++ b/weed/storage/needle/needle.go
@@ -110,7 +110,8 @@ func CreateNeedleFromRequest(r *http.Request, fixJpgOrientation bool, sizeLimit
commaSep := strings.LastIndex(r.URL.Path, ",")
dotSep := strings.LastIndex(r.URL.Path, ".")
fid := r.URL.Path[commaSep+1:]
- if dotSep > 0 {
+ // dot must be after comma; otherwise path[commaSep+1:dotSep] panics
+ if dotSep > commaSep {
fid = r.URL.Path[commaSep+1 : dotSep]
}