mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
fix: Deep is_parent was wrong and could be escapped (#1801)
* fix: Deep is_parent was wrong and could be escapped * Update lib.rs
This commit is contained in:
@@ -773,11 +773,18 @@ mod fns {
|
||||
child: impl AsRef<Path>,
|
||||
) -> Result<bool, AnyError> {
|
||||
let child = {
|
||||
let mut child_count = 0;
|
||||
let mut child = child.as_ref();
|
||||
loop {
|
||||
let meta = tokio::fs::metadata(child).await;
|
||||
if meta.is_ok() {
|
||||
break;
|
||||
if child.ends_with("..") {
|
||||
child_count += 1;
|
||||
} else if child_count > 0 {
|
||||
child_count -= 1;
|
||||
} else {
|
||||
let meta = tokio::fs::metadata(child).await;
|
||||
if meta.is_ok() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
child = match child.parent() {
|
||||
Some(child) => child,
|
||||
|
||||
Reference in New Issue
Block a user