소스 검색

Fixed filename contain two dot cannot open bug

Toby Chui 3 년 전
부모
커밋
0e2e21e458
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      mod/user/directoryHandler.go

+ 1 - 1
mod/user/directoryHandler.go

@@ -86,7 +86,7 @@ func (u *User) VirtualPathToRealPath(vpath string) (string, error) {
 		return "", err
 	}
 
-	if strings.Contains(filepath.Clean(subpath), "..") {
+	if strings.Contains(filepath.ToSlash(filepath.Clean(subpath)), "../") || filepath.Clean(subpath) == ".." {
 		return "", errors.New("Request path out of storage root")
 	}