You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
fix ContentResolver.openFileDescriptor() for file:// URIs
new File() needs to be called with a path not a URI
This commit is contained in:
@@ -28,7 +28,7 @@ public class ContentResolver {
|
|||||||
|
|
||||||
public ParcelFileDescriptor openFileDescriptor(Uri uri, String mode) throws FileNotFoundException {
|
public ParcelFileDescriptor openFileDescriptor(Uri uri, String mode) throws FileNotFoundException {
|
||||||
if ("file".equals(uri.getScheme())) {
|
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 {
|
} else {
|
||||||
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
ContentProvider provider = ContentProvider.providers.get(uri.getAuthority());
|
||||||
if (provider != null)
|
if (provider != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user