Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Bug fix: Filter out empty names from context list #4257

Merged
merged 2 commits into from
Dec 5, 2022
Merged

Conversation

catsby
Copy link
Contributor

@catsby catsby commented Dec 2, 2022

On some operating systems (namely macOS), it's possible for something akin to a .DS_Store file to exist in the directory where contexts are stored. If so, then when a user runs waypoint context list an internal method nameFromPath returns an empty string for said file as it doesn't have a normal file extension. context list then tries to load a non-existing /.hcl file and errors like so:

$ waypoint context list 
! Error loading context "": <nil>: Configuration file not found; The configuration file /Users/clint/Library/Preferences/waypoint/context/.hcl does not exist.

In this PR we simply filter out any non .hcl files before we call nameFromPath, which should save us from any other possible .dotfiles or other files that don't have a file extension at all. It would be odd to have any others in that folder but this should hopefully Catch'em All

@catsby catsby added the pr/no-changelog No automatic changelog entry required for this pull request label Dec 2, 2022
@github-actions github-actions bot added the core label Dec 2, 2022
@catsby catsby requested a review from a team December 2, 2022 19:36
@catsby catsby added core/cli and removed pr/no-changelog No automatic changelog entry required for this pull request core labels Dec 2, 2022
Copy link
Member

@briancain briancain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants