Skip to content
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

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

Closed
EyalSi opened this issue Sep 26, 2017 · 20 comments · Fixed by #395
Closed

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

EyalSi opened this issue Sep 26, 2017 · 20 comments · Fixed by #395

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 "File does not exist"

const urlDecoded = decodeURIComponent(url);
RNFS.stat(urlDecoded)
.then((file) => {
console.log("RNFS URL SUCCESS", file);
})
.catch((err) => {
console.log("RNFS URL ERROR", err);
});

Any idea how to access the file?
10x

@itinance
Copy link
Owner

Hi @EyalSi! The scheme "content://" is currently not supported.

PRs are very appreciated.

@lukasbowen
Copy link

@itinance Does this still need to be resolved? I saw a PR request that could resolve it but I believe it was rejected?

@nzhtrtlc
Copy link

I have the same error, any updates ?

@lukasbowen
Copy link

I have a fix locally in my project; however, I am hesitant to create a PR request since there is one that does the same already pending.

@itinance
Copy link
Owner

@LukBowen which one do you mean?

@lukasbowen
Copy link

PR #49

@itinance
Copy link
Owner

Yes, i remember. I turned back to the contributor but he never answered. I will modify this PR manually to keep backward compatibility alive.

@lukasbowen
Copy link

Sorry, I didn't realize that was it was missing backwards compatibility. Other wise I would have just create my own PR.

@itinance
Copy link
Owner

Submitting your own PR would be a good option! I would merge quickly (while CET-timezone ;) )

@lukasbowen
Copy link

I can still do it; however, it will have to be later today. Currently working on a separate project at work.

@itinance
Copy link
Owner

Great and many thanks. No rush :)

@krzysztof-miemiec
Copy link

krzysztof-miemiec commented Nov 29, 2017

Hey @itinance, I just added a PR based on @jrichardlai's work. I hope we'll finally be able to work with content URI's on Android with no trouble! 🙂

@EyalSi
Copy link
Author

EyalSi commented Jan 11, 2018

I've just tested the latest version (2.9.7) and it's working perfectly! THANKS!

@smithaitufe
Copy link

smithaitufe commented May 19, 2018

It is not working for me.
I installed this package today hoping it will help me get the absolute file path but it is not working
my code is

DocumentPicker.show({ filetype: fileTypeArray }, (error,result) => {
        let uri = Platform.OS === "ios" ? result.uri.replace("file://", "") : `file://${result.uri}`;
        console.log(result)
        const fs = require("react-native-fs")
        fs.stat(decodeURIComponent(uri)).then(resp => {
            console.log(resp)
        })
        let file = {
            uri: result.uri,
            type: result.type,
            name: result.fileName,
            size: result.fileSize,
        }

and this is what I get

05-19 12:57:18.639  6494  7163 W ReactNativeJS: Possible Unhandled Promise Rejection (id: 0):
05-19 12:57:18.639  6494  7163 W ReactNativeJS: Error: File does not exist

Version: "react-native-fs": "^2.9.12",

@kushalsharma12
Copy link

content://com.android.providers.media.documents/document/image%3A400331
I got this when I uploaded an uri from my phone to firebase firestore ... any idea how to get the image from it?

@AliAzaz
Copy link

AliAzaz commented May 31, 2021

@kushalsharma12 have u got any solution for it?

@kushalsharma12
Copy link

@AliAzaz nope

@Usamaliaquat123
Copy link

any solution .... guys

@Merkost
Copy link

Merkost commented Nov 9, 2021

need a solution!

@hareesh7777
Copy link

Hey @itinance, I just added a PR based on @jrichardlai's work. I hope we'll finally be able to work with content URI's on Android with no trouble! 🙂

i'm getting same error File does not exist

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

Successfully merging a pull request may close this issue.