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

Support downloading data URIs #2715

Merged

Conversation

jpelgrom
Copy link
Member

Summary

If the frontend is going to provide data URIs as downloads, the app should try to support them. Unfortunately the WebView won't give the suggested file name in the download callback, so a more generic one is used instead.

Fixes #2711

If the app receives a download request for something that is not supported (not http, https or data) it will now forward it to the system instead of crashing.

Screenshots

A notification will be posted that is very close to the system download manager in appearance and behavior.

Light Dark
A notification by the Home Assistant app: 'Unnamed file - Download complete.', light mode A notification by the Home Assistant app: 'Unnamed file - Download complete.', dark mode

Link to pull request in Documentation repository

n/a

Any other notes

Note for testing with frontend > Settings > Automations & Scenes > automation overflow menu > Debug automation > download icon: tapping on the notification probably won't do much as Android doesn't include an app that supports JSON files by default.

 - Adds support for downloading data URIs
 - Redirect unsupported download requests to the browser (or other app that supports it)
@JBassett JBassett merged commit 8ee0e14 into home-assistant:master Jul 29, 2022
@jpelgrom jpelgrom deleted the fix-data-uri-downloads-2711 branch July 29, 2022 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Download Automation Trace
3 participants