Skip to content

actionViewIntent to throw on unsupported file #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlob.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -410,4 +407,4 @@ public void getSDCardDir(Promise promise) {
public void getSDCardApplicationDir(Promise promise) {
RNFetchBlobFS.getSDCardApplicationDir(this.getReactApplicationContext(), promise);
}
}
}