Repository navigation
Follow macOS Finder aliases in the Files pane - #18191
Merged
Merged
Conversation
Finder aliases are bookmark files rather than symlinks, so the Files pane listed them as opaque binary files and clicking one raised an error. createFileSystemItem now detects aliases (NSURLIsAliasFileKey, excluding symlinks), resolves them without mounting volumes or showing UI, and emits the target path and directory-ness; the client follows the resolved target on click. Unresolvable aliases keep the previous plain-file behavior. Addresses #18158
createFileSystemItem reports a directory alias with dir=true, so the GWT file dialogs (used in server mode) treated one as a folder and cd'd into the bookmark-file path, which fails. Extract the target substitution into FileSystemItem.resolveAliasTarget() and apply it in DirectoryContentsWidget.commitSelection, so dialog navigation follows the alias target just like the Files pane. Addresses #18158
Row commit was resolved in the previous commit, but the Open/Choose buttons read the selection directly: FileDialog.getSelectedItem and navigateIfDirectory re-derive the item via context_.itemForName, OpenFileDialog.shouldAccept cd's into the selected directory, and ChooseFolderDialog2.onSelection records the selected path. Resolve the alias target at each of those points. Addresses #18158
Covers row commit, the Open button on selected and typed directory aliases, the Open button on a file alias, and Choose Directory on a directory alias. Tagged @server_only (Desktop uses native dialogs) and skipped off macOS. Addresses #18158
The dialogs open in the session's last-browsed / working directory, which other specs sharing the session may have moved. Navigate each dialog to Home via its breadcrumb before selecting an alias. Addresses #18158
Platform-independent coverage of the client-side alias substitution: identity for regular files and directories, and target substitution (path and directory-ness) for file and directory alias entries. Addresses #18158
The Home crumb only exists when the browsed path is under ~, so breadcrumb navigation was still order-dependent. Open File tests now type '~' and accept (an explicit navigation shouldAccept supports from any location); the Choose Directory test pins the R working directory first, which is where Workbench.onSetWorkingDir opens the chooser. Addresses #18158
The identity contract is that non-aliases come back unchanged, not as rebuilt items that would drop metadata; compare references instead of path and directory-ness. Addresses #18158
onFileNavigation resolved aliases but the Open commands (openFilesInSinglePane, openEachFileInColumns) passed raw selected items to openFile, so opening a selected file alias loaded the bookmark binary. Resolve in getUnopenedSelectedFiles' pre-process loop, which both commands consume; a directory alias then skips like any other directory. Covered by a new desktop e2e test. Addresses #18158
resolveFinderAlias builds an Error carrying the alias path and the NSError description, but its only caller discarded it, leaving corrupt bookmarks or sandbox denials indistinguishable from non-aliases. Log at debug level (a no-op by default) so the context reaches a consumer without spamming per-file listings. Addresses #18158
The JXA alias-creation block was duplicated across both alias specs and swallowed failures at three layers (system2 status discarded, the JXA write returning false with exit 0, executeInConsole blind to R errors) -- an environmental problem surfaced as per-test visibility timeouts that read like product bugs. Extract the fixture to @utils/finder-aliases, check both failure channels, and assert an ALIAS-SETUP-OK sentinel in beforeAll. Also replaces an ordinal cross-test comment reference and corrects the dialog start-directory comment (getDefaultFileDialogDir, not last-browsed). Addresses #18158
FileDialog.navigateIfDirectory now cd's to the item's absolute path instead of its relative name, a change that affects every platform but was only exercised by the macOS-only alias suite. This spec covers the plain-directory flow without a platform skip, so it runs in Linux server CI. The openFileDialogAtHome helper moves to @utils/file-dialogs for reuse. Addresses #18158
getAliasTarget's doc implied null means not-an-alias, but broken aliases also return null (the backend only emits alias_target on successful resolution); the test mock's comment overstated it as a complete mirror of the listing entry. Addresses #18158
An alias and its target (or two aliases to one file) resolve to the same path, and each duplicate made openEachFileInColumns spawn an extra, empty source column that lingered after the document closed. Gate the pre-process loop on a seen-paths set, mirroring the existing rmdPath dedupe in the notebook branch. The new e2e test pins the column count (probe showed 3 panels for one document before the fix). Addresses #18158
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
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.
Finder aliases are bookmark files rather than symlinks, so the Files pane listed them as opaque binary files and clicking one raised a "file is binary" error.
Note, this did not address Symlinks should have some visual indicator #9924, left as a separate work item.
Changes
isFinderAlias/resolveFinderAliasinSessionModuleContext.mm, using the NSURL bookmark APIs with no volume mounting and no UI. Symlinks are excluded, since the filesystem already follows them.createFileSystemItememits the resolved target asalias_targetand reports the target's directory-ness indir. Broken aliases keep the previous plain-file behavior; resolution failures are logged at debug level.FileSystemItem.resolveAliasTarget():alias_target, so behavior is unchanged.Tests
FinderAliasTest) that create genuine bookmark files via CoreFoundation: detection (including symlink exclusion), resolution, broken-alias fallback, and the listing JSON contractresolveAliasTarget, run on all platforms viaant unittestFixes #18158.