Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

the problem "...exposed beyond app through Intent.getData() " at Android N #358

Open
xiaozhicheng opened this issue May 14, 2017 · 8 comments

Comments

@xiaozhicheng
Copy link

xiaozhicheng commented May 14, 2017

help

@wkh237
Copy link
Owner

wkh237 commented May 14, 2017

@xiaozhicheng , please provide more detailed information about this issue, thanks.

@xiaozhicheng
Copy link
Author

The problem occurred on the Android 7 model,
installing Apk times wrong: android.os.FileUriExposedException:, file://xxxxx.apk, exposed, beyond, app, through, Intent.getData ()

@sagar-teallabs
Copy link

@dantman
Copy link

dantman commented Sep 16, 2017

This could be a result of how RNFB uses PathResolver.getRealPathFromURI and the new File API to read files from common filesystem document providers instead of using getContentResolver().openInputStream(uri).

@lll000111
Copy link
Contributor

lll000111 commented Sep 17, 2017

@wkh237 In this context, is it possible this function is wrong?

https://github.com/wkh237/react-native-fetch-blob/blob/master/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java#L62

It is

public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data)

but if I see this right it should be

public void onActivityResult(int requestCode, int resultCode, Intent data)

Reference: https://developer.android.com/training/basics/intents/result.html

That change also satisfies Android studio, which complains about that method. It also complains about the empty onNewIntent just below ("Method does not override method from its superclass").

I don't want to change anything in the "fetch" part of the code, I only do filesystem (fs.methods)...

@parthgandhi7
Copy link

I am just doing android.actionViewIntent(res.path(), 'image/png')( where res.path() returns '/storage/emulated/0/Download/CatHat1.jpg' ) and it is giving me this error . Full stack trace of error :

Possible Unhandled Promise Rejection (id: 0):
Error: file:///storage/emulated/0/Download/CatHat1.jpg exposed beyond app through Intent.getData()
Error: file:///storage/emulated/0/Download/CatHat1.jpg exposed beyond app through Intent.getData()
    at createErrorFromErrorData (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1787:15)
    at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1744:25
    at MessageQueue.__invokeCallback (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2097:16)
    at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1890:15
    at MessageQueue.__guard (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2028:9)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1889:13)
    at http://localhost:8081/debuggerWorker.js:72:58

Is any workaround or any kind of solution to this problem possible? If yes then please tell me as and when possible. I just want to open the downloaded file in its default file opener.

@parthgandhi7
Copy link

Update , This is not working on android N(7.0) only. It worked fine in 6.0. So i think whatever @sagar-teallabs and @dantman have written is the ultimate problem . Does anyone have a workaround or solution to this?

@Moreno97
Copy link

Moreno97 commented Nov 29, 2017

Check #614 , the problem is fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants