Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 432f775

Browse files
ivk1800Chris Yang
authored and
Chris Yang
committed
[image_picker] fix error if pick image from yandex disk(dropbox) (#1265)
Certain cloud storage platform does not have data column. We return null when there is no data column and fetch the image from online source. fixed flutter/flutter#26940 fixed flutter/flutter#21547
1 parent 5afa9d5 commit 432f775

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

packages/image_picker/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.5.0+7
2+
* Fix a crash when selecting images from yandex.disk and dropbox.
3+
14
## 0.5.0+6
25

36
* Delete the original image if it was scaled.

packages/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/FileUtils.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ private static String getDataColumn(
116116
try {
117117
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
118118
if (cursor != null && cursor.moveToFirst()) {
119-
final int column_index = cursor.getColumnIndexOrThrow(column);
119+
final int column_index = cursor.getColumnIndex(column);
120+
121+
//yandex.disk and dropbox do not have _data column
122+
if (column_index == -1) {
123+
return null;
124+
}
125+
120126
return cursor.getString(column_index);
121127
}
122128
} finally {

packages/image_picker/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors:
55
- Flutter Team <[email protected]>
66
- Rhodes Davis Jr. <[email protected]>
77
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker
8-
version: 0.5.0+6
8+
version: 0.5.0+7
99

1010
flutter:
1111
plugin:

0 commit comments

Comments
 (0)