From 186f0c4132f22fcee59283e8e0e4f8cc4766918e Mon Sep 17 00:00:00 2001 From: elecdeer <37701077+elecdeer@users.noreply.github.com> Date: Sat, 3 Aug 2024 22:59:56 +0900 Subject: [PATCH] fix: resolve issue with unrecognized symblic links --- pkg/config/config.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index da764a1..5d2ad35 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -124,16 +124,23 @@ func resolvePath(path string) (string, bool, error) { return path, false, err } + if fi.Mode()&os.ModeSymlink == os.ModeSymlink { + path, err = os.Readlink(path) + if err != nil { + return path, false, err + } + fi, err = os.Lstat(path) + if err != nil { + return path, false, err + } + } + isDir := fi.IsDir() if filepath.IsAbs(path) { return path, isDir, nil } - if fi.Mode()&os.ModeSymlink == os.ModeSymlink { - path, err = os.Readlink(path) - } - return path, isDir, err }