mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
fix: Js deep dir (#1784)
* fix: Js deep dir * Delete broken.log * Delete test.log * fix: Remove the == parent
This commit is contained in:
@@ -772,7 +772,22 @@ mod fns {
|
||||
parent: impl AsRef<Path>,
|
||||
child: impl AsRef<Path>,
|
||||
) -> Result<bool, AnyError> {
|
||||
let child = tokio::fs::canonicalize(child).await?;
|
||||
let child = {
|
||||
let mut child = child.as_ref();
|
||||
loop {
|
||||
let meta = tokio::fs::metadata(child).await;
|
||||
if meta.is_ok() {
|
||||
break;
|
||||
}
|
||||
child = match child.parent() {
|
||||
Some(child) => child,
|
||||
None => {
|
||||
return Ok(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
tokio::fs::canonicalize(child).await?
|
||||
};
|
||||
let parent = tokio::fs::canonicalize(parent).await?;
|
||||
Ok(child.starts_with(parent))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user