Skip to content

Commit 053483e

Browse files
author
Samuel Navas
committed
added exception with msf scheme from android 10 for document uri
1 parent 3ea8218 commit 053483e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@ else if (isDownloadsDocument(uri)) {
4646
String path = rawuri.getPath();
4747
return path;
4848
}
49+
50+
String docId = null;
51+
//Since Android 10, uri can start with msf scheme like "msf:12345"
52+
if (id != null && id.startsWith("msf:")) {
53+
final String[] split = id.split(":");
54+
docId = Long.valueOf(split[1]);
55+
} else {
56+
docId = Long.valueOf(id);
57+
}
58+
4959
final Uri contentUri = ContentUris.withAppendedId(
50-
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
51-
60+
Uri.parse("content://downloads/public_downloads"), docId);
5261
return getDataColumn(context, contentUri, null, null);
5362
}
5463
catch (Exception ex) {
@@ -212,4 +221,4 @@ public static boolean isGooglePhotosUri(Uri uri) {
212221
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
213222
}
214223

215-
}
224+
}

0 commit comments

Comments
 (0)