Skip to content

Commit

Permalink
fix: handle completion info check error (#330)
Browse files Browse the repository at this point in the history
* fix: handle completion info check error
fixes #329

* make changelog more descriptive
  • Loading branch information
CelestialCrafter authored Nov 23, 2024
1 parent ac7c974 commit 36ce05e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# 🎀 Changelog

## Unreleased
### Fixed
- Skip over file and prevent panic if info cannot be retrieved during file completion (due to permission error or anything else)

## [2.3.3] - 2024-11-04
### Fixed
- Heredocs having issues
Expand Down
7 changes: 5 additions & 2 deletions complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,12 @@ func matchPath(query string) ([]string, string) {

files, _ := os.ReadDir(path)
for _, entry := range files {
// should we handle errors here?
file, err := entry.Info()
if err == nil && file.Mode() & os.ModeSymlink != 0 {
if err != nil {
continue
}

if file.Mode() & os.ModeSymlink != 0 {
path, err := filepath.EvalSymlinks(filepath.Join(path, file.Name()))
if err == nil {
file, err = os.Lstat(path)
Expand Down

0 comments on commit 36ce05e

Please sign in to comment.