Skip to content

fix(sftp): list the drive root when browsing to "C:" on Windows - #316

Merged
kipavy merged 1 commit into
devfrom
fix/local-drive-root-314
Sep 18, 2026
Merged

kipavy merged 1 commit into
devfrom
fix/local-drive-root-314

Conversation

@kipavy

@kipavy kipavy commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Closes #314.

Cause

On Windows a bare drive spec is drive-relative: C: means "the current directory on drive C", not the drive root. fs_list_dir passed the path straight to std::fs::read_dir, so browsing to C: listed the process CWD on that drive — the install directory (uninstall.exe, voltius.exe). C:\ worked, which matches the report.

Three places in the Local Machine pane produced a bare C:: the up-button (computeParentDir returned parts[0] with no separator), the C: breadcrumb crumb, and typing C: in the path bar.

Fix

  • fs_list_dir normalizes a bare drive spec to C:\ before reading it, which covers all three entry points regardless of what the frontend sends.
  • parentDir returns C:\ rather than C: for a drive root, handles UNC roots, and returns "" when there is no parent.
  • The breadcrumb emits C:/ for the drive crumb, and new files/folders are joined with joinPath instead of a hardcoded /.

Also folds FilePane's own parent-directory copy and its three "parent dir + join name" copies (rename, compress, extract) into the shared parentDir/joinPath helpers.

Tests

  • New Rust unit test for the drive-root normalization; cargo test --lib commands::fs passes.
  • New parentDir/joinPath cases for drive roots, UNC roots and roots without a parent; vitest run src/components/filetransfer (21 files, 101 tests) and tsc --noEmit pass.

Not reproducible on Linux, so the Windows behaviour itself still wants a manual check on the reporter's setup.

A bare drive spec is drive-relative on Windows: read_dir("C:") resolves
against the process CWD on that drive, which for an installed build is the
install directory. Normalize it to "C:\" in fs_list_dir, and stop the UI
emitting one from the up-button, the drive breadcrumb and folder creation.

Folds FilePane's own parent-directory and parent-plus-name copies into the
shared parentDir/joinPath helpers, which now keep the drive root separator.

Closes #314
@kipavy
kipavy merged commit 1daa58e into dev Sep 18, 2026
4 checks passed
@kipavy
kipavy deleted the fix/local-drive-root-314 branch September 18, 2026 14:41
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