From 409786059c2b830ae1fe90e405213bbc490a8c50 Mon Sep 17 00:00:00 2001 From: Luke Farrell Date: Thu, 10 Feb 2022 16:44:55 +0100 Subject: [PATCH] fix(timestamp): android failing to read timestamp of file:// paths --- .../java/com/reactnativefileutils/FileUtilsModule.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/android/src/main/java/com/reactnativefileutils/FileUtilsModule.java b/android/src/main/java/com/reactnativefileutils/FileUtilsModule.java index 1628a97..1924353 100644 --- a/android/src/main/java/com/reactnativefileutils/FileUtilsModule.java +++ b/android/src/main/java/com/reactnativefileutils/FileUtilsModule.java @@ -19,7 +19,6 @@ import com.facebook.react.module.annotations.ReactModule; import java.io.FileDescriptor; -import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.text.SimpleDateFormat; @@ -143,13 +142,7 @@ public void getTimestamp(String uri, String mediaType, Promise promise) { // Handle getting mime type for images if (mediaType.equalsIgnoreCase("image")) { - InputStream inputStream = null; - - if(URLUtil.isContentUrl(uri)) { - inputStream = mContext.getContentResolver().openInputStream(fileUri); - } else if(URLUtil.isFileUrl(uri)) { - inputStream = new FileInputStream(uri); - } + InputStream inputStream = mContext.getContentResolver().openInputStream(fileUri); if(inputStream != null) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {