Skip to content

fix(sftp): stop the folder picker hanging on a restricted folder - #356

Merged
FloSch62 merged 1 commit into
FloSch62:mainfrom
antoinekh:fix/sftp-download-folder
Nov 11, 2026
Merged

FloSch62 merged 1 commit into
FloSch62:mainfrom
antoinekh:fix/sftp-download-folder

Conversation

@antoinekh

Copy link
Copy Markdown
Contributor

Problem

In the Windows desktop app, downloading several files from the SFTP panel does nothing when the folder picked is Downloads itself. The folder dialog opens in Downloads, so this is the most natural choice. Every later download of several files, by button or by dragging, then fails with Failed to execute 'showDirectoryPicker' on 'Window': File picker already active. until the app restarts.

Cause

Chromium blocks some folders themselves for the File System Access API (home, Desktop, Documents, Downloads; their children are allowed) and also system folders such as AppData and Program Files. Chromium shows its own prompt when one is picked; Electron instead emits the session event file-system-access-restricted and waits for a listener to call back with allow, deny or tryAgain. The app session has no listener, so the callback is never called, the showDirectoryPicker() promise never settles, and Chromium keeps the picker marked as active.

Fix

The app session (session.defaultSession) now answers allow to file-system-access-restricted: the folder is always one the user picked in the native dialog, and the download never replaces a file already there. Web-host windows use their own session partitions and are not affected.

Testing

  • New unit test tests/unit/electron/file-system-access.test.ts: it emits the event for a Downloads path on a fake session and checks the callback gets allow.
  • Electron typecheck and pnpm lint pass.
  • pnpm test: 2461 tests pass. unit/electron/web-windows.test.ts fails because the Electron binary is not installed on my machine (Electron failed to install correctly). Three server and Electron tests time out only under the full-suite load and pass alone. None of them use this change.
  • Not tested in the desktop app.

@FloSch62

Copy link
Copy Markdown
Owner

thanks @antoinekh

@FloSch62
FloSch62 merged commit a5142e7 into FloSch62:main Nov 11, 2026
5 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.

2 participants