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

Content URI directory support #1074

Open
LitileXueZha opened this issue Jan 12, 2022 · 3 comments
Open

Content URI directory support #1074

LitileXueZha opened this issue Jan 12, 2022 · 3 comments

Comments

@LitileXueZha
Copy link

When I pick a single file, it works fine:

const res = await DocumentPicker.pick();
const content = await fs.readFile(res[0].uri);
// good

When I pick a directory, it does not work:

const res = await DocumentPicker.pickDirectory();
const dirs = await fs.readDir(decodeURIComponent(res.uri)); // decode the uri or it will throw a unsupported error
// not worked, throw a error: Permission Denial...ACTION_OPEN_DOCUMENT...

I see the same problem in this PR, but I don't konw how to do.

Environments:

@sky0014
Copy link

sky0014 commented Jan 30, 2022

same problem

@gj94gj94ao4
Copy link

gj94gj94ao4 commented Feb 24, 2022

Also test RNFS.stat with file and directory:

const result = await RNFS.stat(file);
console.log(result);
// Error: File does not exist

const result = await RNFS.stat(dir)
console.log(result);
// Error: Unsupported Uri content://com.android.externalstorage.documents/tree/primary%3A...

now I am wondering why readFile is work.
in another issue #756

env:

Android 12
"react": "17.0.2",
"react-native": "0.67.2",
"react-native-document-picker": "^8.0.0",
"react-native-fs": "^2.19.0"

@LitileXueZha LitileXueZha changed the title content uri directory support Content URI directory support Feb 26, 2022
@flyskywhy
Copy link

rn-fetch-blob works for me, ref to #756 (comment)

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

No branches or pull requests

4 participants