Skip to content

Commit e8970ab

Browse files
authored
FilePicker: Fix error when multiple images are returned from Documents based picker (#6033)
* FilePicker: Correctly handle Documents result * Empty commit to re-trigger CI checks
1 parent a933b92 commit e8970ab

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

app/src/main/java/fr/free/nrw/commons/filepicker/FilePicker.kt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,8 @@ object FilePicker : Constants {
263263
) {
264264
if (result.resultCode == Activity.RESULT_OK && !isPhoto(result.data)) {
265265
try {
266-
val photoPath = result.data?.data
267-
val photoFile = PickedFiles.pickedExistingPicture(activity, photoPath!!)
268-
callbacks.onImagesPicked(
269-
singleFileList(photoFile),
270-
ImageSource.DOCUMENTS,
271-
restoreType(activity)
272-
)
273-
274-
if (configuration(activity).shouldCopyPickedImagesToPublicGalleryAppFolder()) {
275-
PickedFiles.copyFilesInSeparateThread(activity, singleFileList(photoFile))
276-
}
266+
val files = getFilesFromGalleryPictures(result.data, activity)
267+
callbacks.onImagesPicked(files, ImageSource.DOCUMENTS, restoreType(activity))
277268
} catch (e: Exception) {
278269
e.printStackTrace()
279270
callbacks.onImagePickerError(e, ImageSource.DOCUMENTS, restoreType(activity))

0 commit comments

Comments
 (0)