Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Fix single file upload issue
Browse files Browse the repository at this point in the history
  • Loading branch information
farhan-arshad-dev committed Jan 21, 2021
1 parent 4f27258 commit c1a4434
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d
Uri[] results = null;
if (requestCode == FileUtil.FILE_CHOOSER_RESULT_CODE) {
if (resultCode == Activity.RESULT_OK && data != null) {
String dataString = data.getDataString();
ClipData clipData = data.getClipData();
if (clipData != null) {
results = new Uri[clipData.getItemCount()];
Expand All @@ -318,6 +319,10 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d
results[i] = item.getUri();
}
}
// Executed when user select only one file.
if (dataString != null) {
results = new Uri[]{Uri.parse(dataString)};
}
}
EventBus.getDefault().post(new FileSelectionEvent(results));
}
Expand Down

0 comments on commit c1a4434

Please sign in to comment.