Skip to content

fix: enforce path !empty check no matter file/dir allow states #801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rflandau
Copy link

@rflandau rflandau commented Jun 16, 2025

Describe your changes

This PR corrects didSelectFile()'s logical precendence. Currently, m.Path's nil check is included in the truth value of isDir && m.DirAllowed rather than being a separate truth value. This is due to Go considering logical AND to have a higher precedence than logical OR (source).

Related issue/discussion: N/A

Tests/Steps To Reproduce

You can recreate this issue without any Bubble Tea infrastructure. Here is a trivial example:

func main() {
	path := ""
	fmt.Printf("%v <-- Current\n", true || false && path != "")
	fmt.Printf("%v <-- After This PR\n", (true || false) && path != "")
}

Will result in:

$ go run main.go 
true <-- Current
false <-- After This PR

Checklist before requesting a review

  • I have read CONTRIBUTING.md
  • I have performed a self-review of my code

@rflandau rflandau requested a review from bashbunni as a code owner June 16, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant