Skip to content

fix: attempt at fixing CSV exports crashing aw-android#532

Open
ErikBjare wants to merge 1 commit into
masterfrom
dev/fix-csv-exports-crashing-app
Open

fix: attempt at fixing CSV exports crashing aw-android#532
ErikBjare wants to merge 1 commit into
masterfrom
dev/fix-csv-exports-crashing-app

Conversation

@ErikBjare

Copy link
Copy Markdown
Member

Untested.

Depends on: ActivityWatch/aw-android#109

@codecov

codecov Bot commented Jan 5, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7de395b) 25.55% compared to head (57676d6) 25.55%.
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #532   +/-   ##
=======================================
  Coverage   25.55%   25.55%           
=======================================
  Files          27       27           
  Lines        1616     1616           
  Branches      273      273           
=======================================
  Hits          413      413           
  Misses       1177     1177           
  Partials       26       26           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

TimeToBuildBob added a commit to TimeToBuildBob/aw-android that referenced this pull request Jul 12, 2026
Adds a JavaScript bridge so the webui can trigger native file downloads
on Android. The original download-as-blob approach crashed because the
Android WebView cannot initiate system downloads the same way a browser does.

Changes:
- WebAppInterface: exposes downloadCSV() and downloadJSON() to window.Android
- Uses FileProvider (required API 24+) instead of Uri.fromFile(), which throws
  FileUriExposedException on Android 7.0 and later
- Adds res/xml/file_paths.xml for the provider's path config
- Declares the FileProvider in AndroidManifest.xml

Depends on ActivityWatch/aw-webui#532 (webui side of the bridge).

Fixes ActivityWatch#104
ErikBjare pushed a commit to ActivityWatch/aw-android that referenced this pull request Jul 12, 2026
…186)

* fix: CSV/JSON export via WebAppInterface with FileProvider

Adds a JavaScript bridge so the webui can trigger native file downloads
on Android. The original download-as-blob approach crashed because the
Android WebView cannot initiate system downloads the same way a browser does.

Changes:
- WebAppInterface: exposes downloadCSV() and downloadJSON() to window.Android
- Uses FileProvider (required API 24+) instead of Uri.fromFile(), which throws
  FileUriExposedException on Android 7.0 and later
- Adds res/xml/file_paths.xml for the provider's path config
- Declares the FileProvider in AndroidManifest.xml

Depends on ActivityWatch/aw-webui#532 (webui side of the bridge).

Fixes #104

* fix: harden downloadFile against path traversal, null extDir, write errors, missing viewer
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.

1 participant