Skip to content

Conversation

@ish1416
Copy link

@ish1416 ish1416 commented Nov 10, 2025

Fixes 500 error when accessing local video files in Android external storage directory via convertFileSrc. Added better error handling and logging for Android external storage access to help diagnose permission and accessibility issues.

Closes #14432

  • Enhanced Android-specific error handling in asset protocol handler
  • Added file existence checks before attempting to open files
  • Added detailed logging for debugging Android external storage access
  • Improved error messages with specific guidance for storage permissions
  • Added changelog entry in .changes directory

- Add better error handling and logging for Android external storage paths
- Provide more descriptive error messages when file access fails
- Check file existence and permissions before attempting to open files
- Helps diagnose issues with accessing files in /storage/emulated/0/Android/data/ paths

Fixes tauri-apps#14432
@ish1416 ish1416 requested a review from a team as a code owner November 10, 2025 04:50
@github-project-automation github-project-automation bot moved this to 📬Proposal in Roadmap Nov 10, 2025
@ish1416
Copy link
Author

ish1416 commented Nov 10, 2025

@FabianLars Can you review this PR?

Copy link
Member

@FabianLars FabianLars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the pr :) a few ideas since most of your code should offer value on other platforms as well, not just android.

@ish1416
Copy link
Author

ish1416 commented Nov 10, 2025

@FabianLars Thanks for the review . Ill use your suggestions!

- Make file existence and metadata checks platform-agnostic (not Android-only)
- Remove verbose debug logging that doesn't add value
- Simplify error messages to reduce spam
- Keep Android-specific context only where necessary
@ish1416
Copy link
Author

ish1416 commented Nov 10, 2025

@FabianLars Ive changed in the latest commits whats have been asked can you review it now?

@ish1416 ish1416 requested a review from FabianLars November 12, 2025 03:34
// Check if we have read permissions
if let Err(e) = std::fs::metadata(&path) {
log::error!("Failed to get metadata for {}: {}", path, e);
return resp.status(500).body(format!("Failed to access file metadata: {}", e).into_bytes().into()).map_err(Into::into);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we shouldn't use 500 here since that's our fallback on any kind of error. Any other ideas? 403 comes to mind but we already use that above 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📬Proposal

Development

Successfully merging this pull request may close these issues.

[bug] 500 Error when trying to access local video on android

2 participants