Skip to content

fix(file-explorer): prevent entering files as directories#5383

Merged
nicoburns merged 1 commit intoDioxusLabs:mainfrom
BillionClaw:clawoss/fix/file-explorer-enter-dir
Mar 18, 2026
Merged

fix(file-explorer): prevent entering files as directories#5383
nicoburns merged 1 commit intoDioxusLabs:mainfrom
BillionClaw:clawoss/fix/file-explorer-enter-dir

Conversation

@BillionClaw
Copy link
Copy Markdown
Contributor

Fixes #5368

The file_explorer example had two issues:

  1. Used heuristic (contains '.') to detect files vs directories, which is unreliable (directories can contain dots)
  2. Tried to enter files as directories when clicked, causing errors

Changes:

  • Use path.is_file() for accurate file detection in icon rendering
  • Use path.is_dir() check in enter_dir() before attempting to navigate
  • Rename shadowed path variable to path_display for clarity

This ensures clicking on files doesn't cause navigation errors, and files/directories are correctly identified.

The file_explorer example had two issues:
1. Used heuristic (contains '.') to detect files vs directories, which is unreliable
2. Tried to enter files as directories when clicked, causing errors

Changes:
- Use path.is_file() for accurate file detection
- Use path.is_dir() check before entering a directory
- Rename shadowed 'path' variable to 'path_display'

Fixes DioxusLabs#5368
@BillionClaw BillionClaw requested a review from a team as a code owner March 17, 2026 15:13
@BillionClaw
Copy link
Copy Markdown
Contributor Author

Thank you for the review! This is ready to merge when you get a chance.

@nicoburns nicoburns merged commit be7296f into DioxusLabs:main Mar 18, 2026
18 of 20 checks passed
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.

"file_explorer" example does not work

2 participants