-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(android): improve error handling for external storage file access #14442
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
base: dev
Are you sure you want to change the base?
Conversation
- 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
|
@FabianLars Can you review this PR? |
FabianLars
left a comment
There was a problem hiding this 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.
|
@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
|
@FabianLars Ive changed in the latest commits whats have been asked can you review it now? |
| // 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); |
There was a problem hiding this comment.
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 🤔
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
.changesdirectory