Compare commits
No commits in common. "fedb7446755042e189ca2a5e71cb3a9a0ad80bf1" and "7aa6be4fe78a8508f248bdb7088e48e8b0b3a5f4" have entirely different histories.
fedb744675
...
7aa6be4fe7
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"regexp"
|
|
||||||
"time"
|
"time"
|
||||||
"videoplayer/dao"
|
"videoplayer/dao"
|
||||||
"videoplayer/proto"
|
"videoplayer/proto"
|
||||||
|
|
@ -84,13 +83,6 @@ func CreateConfigFile(req *proto.ConfigFileReq, userId int) error {
|
||||||
}
|
}
|
||||||
//查看系统中是否存在文件,不存在则创建
|
//查看系统中是否存在文件,不存在则创建
|
||||||
file := req.FilePath + "/" + req.FileName
|
file := req.FilePath + "/" + req.FileName
|
||||||
//正则判断文件名是否合法
|
|
||||||
pattern := `^/([^/:\*?]+/)*([^/:\*?]+)?$`
|
|
||||||
reg := regexp.MustCompile(pattern)
|
|
||||||
if reg.MatchString(file) == false {
|
|
||||||
err = fmt.Errorf("file path is invalid")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_, err = os.Stat(file)
|
_, err = os.Stat(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//创建文件
|
//创建文件
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue