From faec979388cde743f56c54c488f137fb4b5d7102 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Fri, 8 Sep 2023 22:12:40 +0800 Subject: [PATCH] fix: recognize symlink directories as files --- core/src/manager/watcher.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/manager/watcher.rs b/core/src/manager/watcher.rs index 1e6c3fcd..f4bf91b1 100644 --- a/core/src/manager/watcher.rs +++ b/core/src/manager/watcher.rs @@ -134,13 +134,13 @@ impl Watcher { let rx = UnboundedReceiverStream::new(rx).chunks_timeout(100, Duration::from_millis(200)); pin!(rx); - while let Some(paths) = rx.next().await { + while let Some(urls) = rx.next().await { let (mut files, mut dirs): (Vec<_>, Vec<_>) = Default::default(); - for path in paths.into_iter().collect::>() { - if fs::symlink_metadata(&path).await.map(|m| !m.is_dir()).unwrap_or(false) { - files.push(path); + for url in urls.into_iter().collect::>() { + if fs::metadata(&url).await.map(|m| !m.is_dir()).unwrap_or(false) { + files.push(url); } else { - dirs.push(path); + dirs.push(url); } }