fix(sftp): list the drive root when browsing to "C:" on Windows - #316
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_dirpassed the path straight tostd::fs::read_dir, so browsing toC: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 (computeParentDirreturnedparts[0]with no separator), theC:breadcrumb crumb, and typingC:in the path bar.Fix
fs_list_dirnormalizes a bare drive spec toC:\before reading it, which covers all three entry points regardless of what the frontend sends.parentDirreturnsC:\rather thanC:for a drive root, handles UNC roots, and returns""when there is no parent.C:/for the drive crumb, and new files/folders are joined withjoinPathinstead of a hardcoded/.Also folds
FilePane's own parent-directory copy and its three "parent dir + join name" copies (rename, compress, extract) into the sharedparentDir/joinPathhelpers.Tests
cargo test --lib commands::fspasses.parentDir/joinPathcases for drive roots, UNC roots and roots without a parent;vitest run src/components/filetransfer(21 files, 101 tests) andtsc --noEmitpass.Not reproducible on Linux, so the Windows behaviour itself still wants a manual check on the reporter's setup.