File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
android/src/main/kotlin/com/mr/flutter/plugin/filepicker Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 1+ ## 10.1.9
2+ ### Android
3+ - Fixed an issue when a folder is selected on an external storage [ #1801 ] ( https://github.com/miguelpruivo/flutter_file_picker/issues/1801 )
4+
15## 10.1.8
26### Android
37- Fixed an issue when a folder is selected [ #1802 ] ( https://github.com/miguelpruivo/flutter_file_picker/issues/1802 )
Original file line number Diff line number Diff line change @@ -503,7 +503,21 @@ object FileUtils {
503503 private fun getPathFromTreeUri (uri : Uri ): String {
504504 val docId = DocumentsContract .getTreeDocumentId(uri)
505505 val parts = docId.split(" :" )
506- return " ${Environment .getExternalStorageDirectory()} /${parts.last()} "
506+
507+ // Check if the URI corresponds to external storage
508+ return if (parts.size > 1 ) {
509+ val volumeId = parts[0 ]
510+ val path = parts[1 ]
511+
512+ // Map volume ID to external storage path
513+ if (" primary" .equals(volumeId, ignoreCase = true )) {
514+ " ${Environment .getExternalStorageDirectory()} /$path "
515+ } else {
516+ " /storage/$volumeId /$path "
517+ }
518+ } else {
519+ " ${Environment .getExternalStorageDirectory()} /${parts.last()} "
520+ }
507521 }
508522
509523 @JvmStatic
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin
33homepage : https://github.com/miguelpruivo/plugins_flutter_file_picker
44repository : https://github.com/miguelpruivo/flutter_file_picker
55issue_tracker : https://github.com/miguelpruivo/flutter_file_picker/issues
6- version : 10.1.8
6+ version : 10.1.9
77
88dependencies :
99 flutter :
You can’t perform that action at this time.
0 commit comments