Skip to content
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

[Bug]: showDirectoryPicker returns AbortError with no alternative when a blocklisted folder is selected #42459

Open
3 tasks done
nicole-branagan opened this issue Jun 12, 2024 · 4 comments · May be fixed by #42561
Open
3 tasks done
Assignees
Labels
30-x-y 31-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/all status/confirmed A maintainer reproduced the bug or agreed with the feature web-platform-apis

Comments

@nicole-branagan
Copy link

Preflight Checklist

Electron Version

30.1.0

What operating system are you using?

macOS

Operating System Version

MacOS Sonoma 14.2.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

N/A

Expected Behavior

If a folder with special permission, like ~/Downloads is selected by showDirectoryPicker, a mechanism should exist to request OS permission and then give access to the folder to the renderer process.

Failing that, it should be possible to distinguish such an AbortError from one that is thrown when the user selects "Cancel"

Actual Behavior

When showDirectoryPicker is used to select a blocklisted folder, an AbortError identical to that shown if the user presses "Cancel" is returned to the app, without any calls to the permission handlers set on the session. This makes it impossible for the app to determine whether the folder is not allowed or whether the user just decided to cancel.

Testcase Gist URL

https://gist.github.com/nicole-branagan/33acff515cfc767333bd10306d17ef17

Additional Information

No response

@electron-issue-triage electron-issue-triage bot added 30-x-y has-repro-gist Issue can be reproduced with code at https://gist.github.com/ labels Jun 12, 2024
@nicole-branagan nicole-branagan changed the title [Bug]: [Bug]: showDirectoryPicker returns AbortError with no alternative when a blocklisted folder is selected Jun 12, 2024
@codebytere codebytere self-assigned this Jun 13, 2024
@codebytere
Copy link
Member

@nicole-branagan what happens in Chrome when you do this?

@nicole-branagan
Copy link
Author

@codebytere Chrome pops up a dialog that says that the folder can't be opened because it contains system files, giving the option to "Cancel" or "Choose a different folder". At that point getting an AbortError if the user chooses to cancel feels fine because they've been given notice.

@codebytere
Copy link
Member

@nicole-branagan thanks! i'll see what i can do :)

@codebytere codebytere added status/confirmed A maintainer reproduced the bug or agreed with the feature 31-x-y platform/all labels Jun 14, 2024
@nicole-branagan
Copy link
Author

@codebytere What would really be nice would be the ability to have the option to override the blocklist on the app level and allow the directory to be chosen anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
30-x-y 31-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/all status/confirmed A maintainer reproduced the bug or agreed with the feature web-platform-apis
Projects
Status: 👍 Does Not Block Stable
Status: 👀 Unsorted Items
Development

Successfully merging a pull request may close this issue.

2 participants