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:
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…
x
Reference in New Issue
Block a user