fix: resolve symlinks for completions

1k commits milestone!! 🎉
job-suspend
sammyette 2023-02-06 17:36:25 -04:00
parent cdd07a4981
commit efc69ab769
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 9 additions and 1 deletions

View File

@ -149,7 +149,15 @@ func matchPath(query string) ([]string, string) {
} }
files, _ := os.ReadDir(path) files, _ := os.ReadDir(path)
for _, file := range files { for _, entry := range files {
// should we handle errors here?
file, _ := entry.Info()
fileInfo, err := entry.Info()
if err == nil && fileInfo.Mode() & os.ModeSymlink != 0 {
path, _ := filepath.EvalSymlinks(filepath.Join(path, file.Name()))
file, _ = os.Lstat(path)
}
if strings.HasPrefix(file.Name(), baseName) { if strings.HasPrefix(file.Name(), baseName) {
entry := file.Name() entry := file.Name()
if file.IsDir() { if file.IsDir() {