Skip to content

Commit 0627359

Browse files
author
奇淼(piexlmax
committed
[fixed]:解决路径判断的错误 #1304
1 parent 01d1e4c commit 0627359

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

server/utils/breakpoint_continue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func CheckMd5(content []byte, chunkMd5 string) (CanUpload bool) {
5555
//@return: string, error
5656

5757
func makeFileContent(content []byte, fileName string, FileDir string, contentNumber int) (string, error) {
58-
if strings.Index(fileName, "./") > -1 || strings.Index(FileDir, "./") > -1 {
58+
if strings.Index(fileName, "..") > -1 || strings.Index(FileDir, "..") > -1 {
5959
return "", errors.New("文件名或路径不合法")
6060
}
6161
path := FileDir + fileName + "_" + strconv.Itoa(contentNumber)

server/utils/zip.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func Unzip(zipFile string, destDir string) ([]string, error) {
1919
defer zipReader.Close()
2020

2121
for _, f := range zipReader.File {
22-
if strings.Index(f.Name, "../") > -1 {
22+
if strings.Index(f.Name, "..") > -1 {
2323
return []string{}, fmt.Errorf("%s 文件名不合法", f.Name)
2424
}
2525
fpath := filepath.Join(destDir, f.Name)

0 commit comments

Comments
 (0)