[fromContentUri] Null/short path causes substring crash
Affected Method (full signature): com.amaze.filemanager.filesystem.files.FileUtils.fromContentUri(@androidx.annotation.NonNull android.net.Uri uri)
Environment: • AmazeFileManager: stock release/4.0 • Robolectric/JVM
Steps to Reproduce (Robolectric-friendly): 1. Uri u = Uri.parse("content://com.example.provider/x"); (very short path) 2. Call File f = FileUtils.fromContentUri(u); 3. Method performs substring(FILE_PROVIDER_PREFIX.length() + 1) on uri.getPath() without length check.
Expected Behavior: Validate length and prefix before substring; gracefully reject/return fallback for malformed content URIs.
Actual Behavior: StringIndexOutOfBoundsException or NullPointerException when getPath() is null/short.
Minimal Input Example: android.net.Uri u = android.net.Uri.parse("content://com.example.provider/x"); java.io.File f = FileUtils.fromContentUri(u); // crash or invalid
Impact: Crashes when browsing or opening content documents with atypical but valid URIs.
Suggested Fix: Guard uri.getPath() for null/length, verify expected prefix before substring, and handle short paths with a safe fallback (or return null/throw a descriptive exception). Prefer robust parsing over fixed offsets.
Hey @EmmanuelMess, Can I work on this bug?