fix ContentResolver.openFileDescriptor() for file:// URIs

new File() needs to be called with a path not a URI
This commit is contained in:
Julian Winkler
2025-01-12 09:57:56 +01:00
parent b22001adbf
commit 99c1e1ee94

View File

@@ -28,7 +28,7 @@ public class ContentResolver {
public ParcelFileDescriptor openFileDescriptor(Uri uri, String mode) throws FileNotFoundException {
if ("file".equals(uri.getScheme())) {
return ParcelFileDescriptor.open(new File(uri.toString()), ParcelFileDescriptor.parseMode(mode));
return ParcelFileDescriptor.open(new File(uri.getPath()), ParcelFileDescriptor.parseMode(mode));
} else {
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
if (provider != null)