fix(search): empty parent where update (close #2810)

This commit is contained in:
Noah Hsu
2023-01-16 17:33:24 +08:00
parent 1cfd47a258
commit 6453ae0968
7 changed files with 23 additions and 20 deletions

View File

@ -9,10 +9,10 @@ func IsBalance(str string) bool {
}
// GetActualMountPath remove balance suffix
func GetActualMountPath(virtualPath string) string {
bIndex := strings.LastIndex(virtualPath, ".balance")
func GetActualMountPath(mountPath string) string {
bIndex := strings.LastIndex(mountPath, ".balance")
if bIndex != -1 {
virtualPath = virtualPath[:bIndex]
mountPath = mountPath[:bIndex]
}
return virtualPath
return mountPath
}

View File

@ -80,3 +80,7 @@ func JoinBasePath(basePath, reqPath string) (string, error) {
}
return stdpath.Join(FixAndCleanPath(basePath), FixAndCleanPath(reqPath)), nil
}
func GetFullPath(mountPath, path string) string {
return stdpath.Join(GetActualMountPath(mountPath), path)
}