Skip to content

Commit 5f901b8

Browse files
jonryanedgesxyazi
andauthored
fix: clean entry URLs on boot (#4318)
Co-authored-by: 三咲雅 misaki masa <sxyazi@gmail.com>
1 parent 3cf9fb2 commit 5f901b8

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

yazi-boot/src/boot.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,17 @@ impl Boot {
1919
return (vec![CWD.load().as_ref().clone()], vec![Default::default()]);
2020
}
2121

22-
async fn go(entry: &UrlBuf) -> (UrlBuf, StrandBuf) {
23-
let mut entry = clean_url(entry);
22+
async fn go(ent: &UrlBuf) -> (UrlBuf, StrandBuf) {
23+
let ent = clean_url(engine::absolute(ent).await.unwrap_or(ent.into()));
2424

25-
if let Ok(u) = engine::absolute(&entry).await
26-
&& u.is_owned()
27-
{
28-
entry = u.into_owned();
29-
}
30-
31-
let Some((trail, child)) = entry.pair() else {
32-
return (entry, Default::default());
25+
let Some((trail, child)) = ent.pair() else {
26+
return (ent, Default::default());
3327
};
3428

35-
if engine::metadata(&entry).await.is_ok_and(|m| m.is_file()) {
29+
if engine::metadata(&ent).await.is_ok_and(|m| m.is_file()) {
3630
(trail.into(), child.into())
3731
} else {
38-
(entry, Default::default())
32+
(ent, Default::default())
3933
}
4034
}
4135

0 commit comments

Comments
 (0)