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

Selected image can not be displayed when src is file:// #3797

Closed
adzialocha opened this issue Apr 30, 2024 · 2 comments · Fixed by #3800
Closed

Selected image can not be displayed when src is file:// #3797

adzialocha opened this issue Apr 30, 2024 · 2 comments · Fixed by #3800
Assignees
Labels
blocker This issue is blocking a new release bug Something isn't working

Comments

@adzialocha
Copy link
Member

Selecting an image via runtime.showOpenFileDialog and then displaying the file using the selected path leads to the following error:

GET file:///<path_to_image>.png net::ERR_BLOCKED_BY_CLIENT

This seems to be related to the changes made in 5dfd937

I assume we have to base64 encode the file contents and display this in the element instead to comply with the new restrictions.

@adzialocha adzialocha added the bug Something isn't working label Apr 30, 2024
@adzialocha adzialocha changed the title Selected image can not be displayed when from file:// Selected image can not be displayed when src is file:// Apr 30, 2024
@Simon-Laux
Copy link
Member

Simon-Laux commented Apr 30, 2024

I think the easiest solution would be that runtime.showOpenFileDialog adds the opened path to a temporary whitelist of allowed paths.
There is no core api yet to pass bobs as base64 to core directly. So if we work with base64 we would need to temporarily save the file to the temp folder and then give that path to core (and ideally delete the temp file again after it was copied by core).

@Simon-Laux Simon-Laux self-assigned this Apr 30, 2024
@Simon-Laux Simon-Laux added the blocker This issue is blocking a new release label Apr 30, 2024
@WofWca
Copy link
Collaborator

WofWca commented May 1, 2024

We don't have pass Base64 to core. We could return two things from runtime.showOpenFileDialog: the path (for the core) and the Base64 string (or, perhaps File), for the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker This issue is blocking a new release bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants