🔥 remove useless code
This commit is contained in:
parent
71b1517de7
commit
50a02a7af7
@ -48,7 +48,7 @@ func CheckParent(path string, password string) bool {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
if path == "/" || path == "\\" {
|
if path == "/" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return CheckParent(utils.Dir(path), password)
|
return CheckParent(utils.Dir(path), password)
|
||||||
@ -71,7 +71,7 @@ func CheckDownLink(path string, passwordMd5 string) bool {
|
|||||||
if !conf.CheckParent {
|
if !conf.CheckParent {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if path == "/" || path == "\\" {
|
if path == "/" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return CheckDownLink(utils.Dir(path), passwordMd5)
|
return CheckDownLink(utils.Dir(path), passwordMd5)
|
||||||
|
@ -94,7 +94,7 @@ func GetPW(path string) string {
|
|||||||
if !conf.CheckParent {
|
if !conf.CheckParent {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if path == "/" || path == "\\" {
|
if path == "/" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return GetPW(utils.Dir(path))
|
return GetPW(utils.Dir(path))
|
||||||
|
@ -97,7 +97,12 @@ func RemoveLastSlash(path string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Dir(path string) string {
|
func Dir(path string) string {
|
||||||
path = ParsePath(path)
|
|
||||||
idx := strings.LastIndex(path, "/")
|
idx := strings.LastIndex(path, "/")
|
||||||
|
if idx == 0 {
|
||||||
|
return "/"
|
||||||
|
}
|
||||||
|
if idx == -1 {
|
||||||
|
return path
|
||||||
|
}
|
||||||
return path[:idx]
|
return path[:idx]
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user