diff --git a/yazi-shared/src/fs/path.rs b/yazi-shared/src/fs/path.rs index dd8343e0..e6b02b41 100644 --- a/yazi-shared/src/fs/path.rs +++ b/yazi-shared/src/fs/path.rs @@ -101,14 +101,13 @@ pub async fn unique_name(mut u: Url) -> io::Result { let mut name = OsString::with_capacity(stem.len() + ext.len() + 5); name.push(&stem); - // Check if it's a directory + if p.is_dir() { - // For directories, append the index at the end + name.push("_"); name.push(i.to_string()); name.push(&ext); - } else { - // For files, keep the existing behavior + } else name.push("_"); name.push(i.to_string()); name.push(&ext);