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

Commit 40fefd4

Browse files
committed
Add Android fs.readFile app provider URI support #287
1 parent 4d15c0f commit 40fefd4

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

android/src/main/java/com/RNFetchBlob/Utils/PathResolver.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ else if (isMediaDocument(uri)) {
5959

6060
return getDataColumn(context, contentUri, selection, selectionArgs);
6161
}
62+
else if ("content".equalsIgnoreCase(uri.getScheme())) {
63+
64+
// Return the remote address
65+
if (isGooglePhotosUri(uri))
66+
return uri.getLastPathSegment();
67+
68+
return getDataColumn(context, uri, null, null);
69+
}
6270
}
6371
// MediaStore (and general)
6472
else if ("content".equalsIgnoreCase(uri.getScheme())) {
@@ -103,7 +111,12 @@ public static String getDataColumn(Context context, Uri uri, String selection,
103111
final int index = cursor.getColumnIndexOrThrow(column);
104112
return cursor.getString(index);
105113
}
106-
} finally {
114+
}
115+
catch (Exception ex) {
116+
ex.printStackTrace();
117+
return null;
118+
}
119+
finally {
107120
if (cursor != null)
108121
cursor.close();
109122
}

0 commit comments

Comments
 (0)