mirror of https://github.com/Hilbis/Hilbish
fix: check for error on resolving symlink
parent
efc69ab769
commit
6b27d14f45
11
complete.go
11
complete.go
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue