Repository navigation
avoid using openExternal for file URIs on Windows - #13926
Merged
Merged
Conversation
gtritchie
approved these changes
Nov 13, 2023
| ipcMain.on('desktop_browse_url', (event, url: string) => { | ||
|
|
||
| // shell.openExternal() doesn't handle file URIs containining non-ASCII characters | ||
| // shell.openExternal() seems unreliable on Windows |
Member
There was a problem hiding this comment.
Looks to be tracked (more or less) via electron/electron#31347, maybe add that in the comment in case we want to revisit someday and see if it has been fixed?
4 tasks done
jennybc
added a commit
to posit-dev/positron
that referenced
this pull request
Oct 20, 2025
Addresses #9985 This fixes `UiFrontendEvent.OpenWithSystem`, which is experienced as `browseURL()` working in R for local filepaths that contain non-ascii characters, on Windows. Here's a screenshot of executing `browseURL("tütü")` on Windows, where there is a local folder named "tütü". And it now dutifully opens in the Windows file explorer. <img width="1388" height="608" alt="Screenshot 2025-10-20 110409" src="https://github.com/user-attachments/assets/dd4771ec-fcf8-4830-934a-c5e36e68e261" /> Before this fix the result looked like so: <img width="593" height="255" alt="Screenshot 2025-10-17 142907" src="https://github.com/user-attachments/assets/140d40b8-b54c-41aa-832d-8f657ab29138" /> `UiFrontendEvent.OpenWithSystem` ultimately routes into `NativeHostMainService.doOpenShellExternal()` which previously called (only) electron's `shell.openExternal()`, which is really designed for URLs, but also works for filepaths in many cases. However, on Windows, `shell.openExternal()` falls over for local filepaths with non-ascii characters and the recommended solution is to use `shell.openPath()` instead which really is meant exactly for this: "Open the given file in the desktop's default manner." Related links: * Main issue for this in electron: <electron/electron#6302> * Another report of same in electron: <electron/electron#31347> * VS Code issue that effectively tracks this problem: <microsoft/vscode#85930> * Same problem affecting RStudio: <rstudio/rstudio#12467> * How RStudio solved it: <rstudio/rstudio#13926> * Related discussion/fix in another project that I found helpful: <laurent22/joplin#4804 (comment)> ### Release Notes <!-- Optionally, replace `N/A` with text to be included in the next release notes. The `N/A` bullets are ignored. If you refer to one or more Positron issues, these issues are used to collect information about the feature or bugfix, such as the relevant language pack as determined by Github labels of type `lang: `. The note will automatically be tagged with the language. These notes are typically filled by the Positron team. If you are an external contributor, you may ignore this section. --> #### New Features - N/A #### Bug Fixes - N/A ### QA Notes <!-- Positron team members: please add relevant e2e test tags, so the tests can be run when you open this pull request. - Instructions: https://github.com/posit-dev/positron/blob/main/test/e2e/README.md#pull-requests-and-test-tags - Available tags: https://github.com/posit-dev/positron/blob/main/test/e2e/infra/test-runner/test-tags.ts --> <!-- Add additional information for QA on how to validate the change, paying special attention to the level of risk, adjacent areas that could be affected by the change, and any important contextual information not present in the linked issues. -->
seeM
pushed a commit
to posit-dev/positron
that referenced
this pull request
Oct 21, 2025
Addresses #9985 This fixes `UiFrontendEvent.OpenWithSystem`, which is experienced as `browseURL()` working in R for local filepaths that contain non-ascii characters, on Windows. Here's a screenshot of executing `browseURL("tütü")` on Windows, where there is a local folder named "tütü". And it now dutifully opens in the Windows file explorer. <img width="1388" height="608" alt="Screenshot 2025-10-20 110409" src="https://github.com/user-attachments/assets/dd4771ec-fcf8-4830-934a-c5e36e68e261" /> Before this fix the result looked like so: <img width="593" height="255" alt="Screenshot 2025-10-17 142907" src="https://github.com/user-attachments/assets/140d40b8-b54c-41aa-832d-8f657ab29138" /> `UiFrontendEvent.OpenWithSystem` ultimately routes into `NativeHostMainService.doOpenShellExternal()` which previously called (only) electron's `shell.openExternal()`, which is really designed for URLs, but also works for filepaths in many cases. However, on Windows, `shell.openExternal()` falls over for local filepaths with non-ascii characters and the recommended solution is to use `shell.openPath()` instead which really is meant exactly for this: "Open the given file in the desktop's default manner." Related links: * Main issue for this in electron: <electron/electron#6302> * Another report of same in electron: <electron/electron#31347> * VS Code issue that effectively tracks this problem: <microsoft/vscode#85930> * Same problem affecting RStudio: <rstudio/rstudio#12467> * How RStudio solved it: <rstudio/rstudio#13926> * Related discussion/fix in another project that I found helpful: <laurent22/joplin#4804 (comment)> ### Release Notes <!-- Optionally, replace `N/A` with text to be included in the next release notes. The `N/A` bullets are ignored. If you refer to one or more Positron issues, these issues are used to collect information about the feature or bugfix, such as the relevant language pack as determined by Github labels of type `lang: `. The note will automatically be tagged with the language. These notes are typically filled by the Positron team. If you are an external contributor, you may ignore this section. --> #### New Features - N/A #### Bug Fixes - N/A ### QA Notes <!-- Positron team members: please add relevant e2e test tags, so the tests can be run when you open this pull request. - Instructions: https://github.com/posit-dev/positron/blob/main/test/e2e/README.md#pull-requests-and-test-tags - Available tags: https://github.com/posit-dev/positron/blob/main/test/e2e/infra/test-runner/test-tags.ts --> <!-- Add additional information for QA on how to validate the change, paying special attention to the level of risk, adjacent areas that could be affected by the change, and any important contextual information not present in the linked issues. -->
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.
Intent
Addresses #13886.
Approach
It appears that Electron's
shell.openExternal()struggles with certain kinds of Windows paths. This PR falls back to using our trusty friendShellExecute()to open these files.Automated Tests
N/A
QA Notes
Test via notes in #13886.
Documentation
N/A
Checklist
NEWS.md