瀏覽代碼

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")
 	}