react-native-blob-util
react-native-blob-util copied to clipboard
Handle externalstorage.documents in getRealPathFromURI
Related to #365
I doubt this is really a recommended way to do things, but it's okay for my use case and figured I would share in case others find it useful.
Did you test if it works with normalizing the path as it does in other locations?
This patch works, but in my case the method PathResolver::getRealPathFromURI fails for this branch:
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
...
if (isExternalStorageDocument(uri)) {
...
if ("primary".equalsIgnoreCase(type)) {
// this will return the package's directory and not the external storage directory
File dir = context.getExternalFilesDir(null);
and this must be changed to File dir = Environment.getExternalStorageDirectory(); aswell.