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)
|
files, _ := os.ReadDir(path)
|
||||||
for _, entry := range files {
|
for _, entry := range files {
|
||||||
// should we handle errors here?
|
// should we handle errors here?
|
||||||
file, _ := entry.Info()
|
file, err := entry.Info()
|
||||||
fileInfo, err := entry.Info()
|
if err == nil && file.Mode() & os.ModeSymlink != 0 {
|
||||||
if err == nil && fileInfo.Mode() & os.ModeSymlink != 0 {
|
path, err := filepath.EvalSymlinks(filepath.Join(path, file.Name()))
|
||||||
path, _ := filepath.EvalSymlinks(filepath.Join(path, file.Name()))
|
if err == nil {
|
||||||
file, _ = os.Lstat(path)
|
file, err = os.Lstat(path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(file.Name(), baseName) {
|
if strings.HasPrefix(file.Name(), baseName) {
|
||||||
|
|
Loading…
Reference in New Issue