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

access content://com.android.providers.media.documents/document/image%3A99 #536

Open
EyalSi opened this issue Sep 26, 2017 · 3 comments
Open

Comments

@EyalSi
Copy link

EyalSi commented Sep 26, 2017

I'm getting a content:// uri in android while using react-native-document-picker or react-native-contacts (for the avatars).
URIs like:
'content://com.android.providers.media.documents/document/image%3A99'
Trying to access this file fails with "stat error: failed to list path null for it is not exist or it is not a folder'"

const urlDecoded = decodeURIComponent(url);
return new Promise((resolve, reject) => {
RNFetchBlob.fs.stat(urlDecoded)
.then(resolve)
.catch(reject);
});

Any idea how to access the file?
10x

@tombailey
Copy link

You should take a look at my PR (#546) although I haven't touch the FS part of this library.

The current implementation in this library for content URIs on Android seems to try to find the file path for a given content URIs. If the file is a virtual file or in a place your app doesn't have access to, this is problematic.

@EyalSi
Copy link
Author

EyalSi commented Jan 11, 2018

There is now a solution for this problem in react-native-fs. Enabling access and copy content:// files -itinance/react-native-fs#395

@anarchytech
Copy link

Good

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

No branches or pull requests

3 participants