-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: emit an event when accessing restricted path in File System Access API #42561
base: main
Are you sure you want to change the base?
Conversation
1f08bd4
to
297c490
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Electron has historically never contained user-facing UI. It introduces problems around messaging, UI style, translations, etc.
Is this not something that apps can understand and implement themselves?
@MarshallOfSound we have for other web platform APIs in specific circumstances, but - at the moment we log-only, which i don't think is a good experience either, for reasons in part outlined by the issue author. We could potentially emit an event? |
@codebytere we emit events for device choosers from Session (eg https://www.electronjs.org/docs/latest/api/session#event-select-usb-device) when upstream would should a dialog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should emit an event and let developers handle this much like we do for the device choosers.
@jkleinsc ah good shout - i'll do that! |
297c490
to
1564af6
Compare
1564af6
to
24ee962
Compare
would there be a way to allow the restricted directory to be used? because currently this doesn't let you choose ~/Downloads on macOS if we want our web app to save multiple files in there |
24ee962
to
4cfcc79
Compare
@marcello3d reworked it a bit - a69e079 should enable that! |
c7580ad
to
f04260c
Compare
f04260c
to
076c0c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs need some clarification.
docs/api/session.md
Outdated
* `isDirectory` boolean - Whether or not the path is a directory. | ||
* `path` string - The blocked path attempting to be accessed. | ||
* `callback` Function | ||
* `action` string - Can be one of `block`, `tryAgain`, or `allow`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs should explain what the different actions mean.
076c0c6
to
5637924
Compare
Description of Change
Closes #42459
More closely match upstream spec behavior when File System Access API attempts to open a file or directory in a blocked path. Now, a
file-system-access-restricted
event is emitted onsession
when a user attempts to access a restricted path:Developers can then decide how to proceed.
Checklist
npm test
passesRelease Notes
Notes: Aligned failure pathway in File System Access API with upstream when attempting to open a file or directory in a blocked path.