Skip to content

Commit f9dc1ec

Browse files
committed
修复从SAF选择文件时id解析异常的问题
1 parent 3befa9b commit f9dc1ec

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/utilcode/src/main/java/com/blankj/utilcode/util/UriUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,15 @@ else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
177177
return null;
178178
}// end 1_0
179179
else if ("com.android.providers.downloads.documents".equals(authority)) {
180-
final String id = DocumentsContract.getDocumentId(uri);
180+
String id = DocumentsContract.getDocumentId(uri);
181181
if (TextUtils.isEmpty(id)) {
182182
Log.d("UriUtils", uri.toString() + " parse failed(id is null). -> 1_1");
183183
return null;
184184
}
185185
if (id.startsWith("raw:")) {
186186
return new File(id.substring(4));
187+
} else if (id.startsWith("msf:")) {
188+
id = id.split(":")[1];
187189
}
188190

189191
String[] contentUriPrefixesToTry = new String[]{

0 commit comments

Comments
 (0)