mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-01 10:17:47 +03:00
fix: ensure that LINK
and ORPHAN
cannot coexist
This commit is contained in:
parent
a1c963accc
commit
85334457f3
@ -38,8 +38,6 @@ impl From<Metadata> for Cha {
|
||||
let mut ck = ChaKind::empty();
|
||||
if m.is_dir() {
|
||||
ck |= ChaKind::DIR;
|
||||
} else if m.is_symlink() {
|
||||
ck |= ChaKind::LINK;
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
|
@ -31,13 +31,14 @@ impl File {
|
||||
let (is_link, mut link_to) = (meta.is_symlink(), None);
|
||||
|
||||
if is_link {
|
||||
ck |= ChaKind::LINK;
|
||||
meta = fs::metadata(&url).await.unwrap_or(meta);
|
||||
link_to = fs::read_link(&url).await.map(Url::from).ok();
|
||||
}
|
||||
|
||||
if is_link && meta.is_symlink() {
|
||||
ck |= ChaKind::ORPHAN;
|
||||
} else if is_link {
|
||||
ck |= ChaKind::LINK;
|
||||
}
|
||||
|
||||
if url.is_hidden() {
|
||||
|
Loading…
Reference in New Issue
Block a user