From 880dd20b18852fc6978942664b98c015123f2881 Mon Sep 17 00:00:00 2001 From: Sam Killen <49190113+skk64@users.noreply.github.com> Date: Sun, 8 Feb 2026 14:57:45 +1100 Subject: [PATCH] Make symlinks to directories to return as directories, not files (#4676) Fix #4675 --- src/reader.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/reader.go b/src/reader.go index 85cc2853..76df4a5a 100644 --- a/src/reader.go +++ b/src/reader.go @@ -303,8 +303,12 @@ func (r *Reader) readFiles(roots []string, opts walkerOpts, ignores []string) bo } path = trimPath(path) if path != "." { - isDir := de.IsDir() - if isDir || opts.follow && isSymlinkToDir(path, de) { + isDirSymlink := isSymlinkToDir(path, de) + if isDirSymlink && !opts.follow { + return filepath.SkipDir + } + isDir := de.IsDir() || isDirSymlink + if isDir { base := filepath.Base(path) if !opts.hidden && base[0] == '.' && base != ".." { return filepath.SkipDir