itinance / itinance/react-native-fs

Unsupported Content URI

Open
#1,070 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

I'm using `react-native-document-picker` to pick up a folder and using `react-native-fs` to save a file to that folder. Since `react-native-document-picker` returns a content uri not absolute path. I use `stat` to get the real path.

```typescript
try {
const url = await DocumentPicker.pickDirectory()
const stat = await RNFS.stat(`${url.uri}`)
} catch (e) {
console.log('save failed', e)
}
```

I got error on Android:
```
save failed [Error: Unsupported Uri content://com.android.externalstorage.documents/tree/primary%3ADocuments]
```
**It seems `stat` does not work on directory?**

I've alread graint the permissions:

```

```
And set `android:requestLegacyExternalStorage="true"`

Here's my `build.gradle`

```
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.