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.

ensure file name does not contain any "/"

Chris Lu0b7a235c1746
diff --git a/weed-fs/src/pkg/storage/needle.go b/weed-fs/src/pkg/storage/needle.go
index 5f2f39f906..2ab6714264 100644
--- a/weed-fs/src/pkg/storage/needle.go
+++ b/weed-fs/src/pkg/storage/needle.go
@@ -6,6 +6,7 @@ import (
"io/ioutil"
"mime"
"net/http"
+ "path"
"pkg/util"
"strconv"
"strings"
@@ -50,6 +51,7 @@ func NewNeedle(r *http.Request) (n *Needle, fname string, e error) {
return
}
fname = part.FileName()
+ fname = path.Base(fname)
data, _ := ioutil.ReadAll(part)
dotIndex := strings.LastIndex(fname, ".")
ext, mtype := "", ""