From befe1ff900542e1970df4dfddf9f52267e7199b6 Mon Sep 17 00:00:00 2001 From: Jacob Lauritzen Date: Tue, 20 Nov 2018 10:40:07 -0500 Subject: [PATCH] actionViewIntent to throw on unsupported file --- android/src/main/java/com/RNFetchBlob/RNFetchBlob.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java index ac9ce5669..14b11e38b 100644 --- a/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java +++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java @@ -120,11 +120,8 @@ public void actionViewIntent(String path, String mime, final Promise promise) { // Set flag to give temporary permission to external app to use FileProvider intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - // Validate that the device can open the file - PackageManager pm = getCurrentActivity().getPackageManager(); - if (intent.resolveActivity(pm) != null) { - this.getReactApplicationContext().startActivity(intent); - } + // Do not validate that the device can open the file - instead let it throw + this.getReactApplicationContext().startActivity(intent); } else { Intent intent = new Intent(Intent.ACTION_VIEW) @@ -410,4 +407,4 @@ public void getSDCardDir(Promise promise) { public void getSDCardApplicationDir(Promise promise) { RNFetchBlobFS.getSDCardApplicationDir(this.getReactApplicationContext(), promise); } -} \ No newline at end of file +}