[fixed]:解决路径判断的错误 #1304

This commit is contained in:
奇淼(piexlmax
2022-12-08 19:13:31 +08:00
parent 01d1e4c7f5
commit 0627359b6e
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ func CheckMd5(content []byte, chunkMd5 string) (CanUpload bool) {
//@return: string, error
func makeFileContent(content []byte, fileName string, FileDir string, contentNumber int) (string, error) {
if strings.Index(fileName, "./") > -1 || strings.Index(FileDir, "./") > -1 {
if strings.Index(fileName, "..") > -1 || strings.Index(FileDir, "..") > -1 {
return "", errors.New("文件名或路径不合法")
}
path := FileDir + fileName + "_" + strconv.Itoa(contentNumber)