mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-22 22:53:33 +08:00
ensure file name does not contain any "/"
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path"
|
||||||
"pkg/util"
|
"pkg/util"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -50,6 +51,7 @@ func NewNeedle(r *http.Request) (n *Needle, fname string, e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
fname = part.FileName()
|
fname = part.FileName()
|
||||||
|
fname = path.Base(fname)
|
||||||
data, _ := ioutil.ReadAll(part)
|
data, _ := ioutil.ReadAll(part)
|
||||||
dotIndex := strings.LastIndex(fname, ".")
|
dotIndex := strings.LastIndex(fname, ".")
|
||||||
ext, mtype := "", ""
|
ext, mtype := "", ""
|
||||||
|
Reference in New Issue
Block a user