Skip to content

Commit 01ffb6d

Browse files
authored
Merge pull request #14 from 3mundi/fix_uri_msf_scheme_android10
Fix uri msf scheme android10
2 parents f6672b0 + fe61e0b commit 01ffb6d

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
@@ -45,9 +45,18 @@ else if (isDownloadsDocument(uri)) {
4545
String path = rawuri.getPath();
4646
return path;
4747
}
48+
49+
Long docId = null;
50+
//Since Android 10, uri can start with msf scheme like "msf:12345"
51+
if (id != null && id.startsWith("msf:")) {
52+
final String[] split = id.split(":");
53+
docId = Long.valueOf(split[1]);
54+
} else {
55+
docId = Long.valueOf(id);
56+
}
57+
4858
final Uri contentUri = ContentUris.withAppendedId(
49-
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
50-
59+
Uri.parse("content://downloads/public_downloads"), docId);
5160
return getDataColumn(context, contentUri, null, null);
5261
}
5362
catch (Exception ex) {
@@ -211,4 +220,4 @@ public static boolean isGooglePhotosUri(Uri uri) {
211220
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
212221
}
213222

214-
}
223+
}

0 commit comments

Comments
 (0)