diff --git a/CHANGELOG.md b/CHANGELOG.md index 057141f..5b0105e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - fish: `cd` command is now copied directly from `$__fish_data_dir/functions/cd.fish`. This should minimize the chances of an infinite loop when aliasing `cd=z`. +- Symlinks not getting added to the database when `$_ZO_RESOLVE_SYMLINKS=0`. ## [0.9.4] - 2024-02-21 diff --git a/src/db/stream.rs b/src/db/stream.rs index 9b51af1..4af7d7a 100644 --- a/src/db/stream.rs +++ b/src/db/stream.rs @@ -83,8 +83,12 @@ impl<'a> Stream<'a> { if !self.options.exists { return true; } + + // The logic here is reversed - if we resolve symlinks when adding entries to + // the database, we should not return symlinks when querying back from + // the database. let resolver = - if self.options.resolve_symlinks { fs::metadata } else { fs::symlink_metadata }; + if self.options.resolve_symlinks { fs::symlink_metadata } else { fs::metadata }; resolver(path).map(|metadata| metadata.is_dir()).unwrap_or_default() } }