mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-10-10 04:53:09 +08:00
fix(fs): rename bug (#832)
* fix(fs): rename bug * chore * fix bug * . --------- Co-authored-by: j2rong4cn <j2rong@qq.com>
This commit is contained in:
+4
-12
@@ -75,20 +75,12 @@ func EncodePath(path string, all ...bool) string {
|
||||
}
|
||||
|
||||
func JoinBasePath(basePath, reqPath string) (string, error) {
|
||||
reqPath, err := CheckRelativePath(reqPath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return stdpath.Join(FixAndCleanPath(basePath), reqPath), nil
|
||||
}
|
||||
|
||||
func CheckRelativePath(path string) (string, error) {
|
||||
isRelativePath := strings.Contains(path, "..")
|
||||
path = FixAndCleanPath(path)
|
||||
if isRelativePath && !strings.Contains(path, "..") {
|
||||
isRelativePath := strings.Contains(reqPath, "..")
|
||||
reqPath = FixAndCleanPath(reqPath)
|
||||
if isRelativePath && !strings.Contains(reqPath, "..") {
|
||||
return "", errs.RelativePath
|
||||
}
|
||||
return path, nil
|
||||
return stdpath.Join(FixAndCleanPath(basePath), reqPath), nil
|
||||
}
|
||||
|
||||
func GetFullPath(mountPath, path string) string {
|
||||
|
||||
Reference in New Issue
Block a user