mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-15 20:06:19 +08:00
checking file name empty
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"code.google.com/p/weed-fs/go/util"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
"code.google.com/p/weed-fs/go/util"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -51,7 +52,12 @@ func NewNeedle(r *http.Request) (n *Needle, fname string, e error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
fname = part.FileName()
|
fname = part.FileName()
|
||||||
fname = path.Base(fname)
|
if fname != "" {
|
||||||
|
fname = path.Base(part.FileName())
|
||||||
|
} else {
|
||||||
|
e = errors.New("No file found!")
|
||||||
|
return
|
||||||
|
}
|
||||||
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