2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-02 11:43:23 +00:00

fix: check for error on resolving symlink

This commit is contained in:
sammyette 2023-02-07 10:42:36 -04:00
parent efc69ab769
commit 6b27d14f45
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

@ -151,11 +151,12 @@ func matchPath(query string) ([]string, string) {
files, _ := os.ReadDir(path)
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)
file, err := entry.Info()
if err == nil && file.Mode() & os.ModeSymlink != 0 {
path, err := filepath.EvalSymlinks(filepath.Join(path, file.Name()))
if err == nil {
file, err = os.Lstat(path)
}
}
if strings.HasPrefix(file.Name(), baseName) {