Explorar el Código

fix: asyncUpload logic error

pu hace 4 años
padre
commit
388f44580f

+ 7
- 4
android/src/main/java/com/reactlibrary/AliyunUploadManager.java Ver fichero

@@ -148,10 +148,13 @@ public class AliyunUploadManager {
148 148
         try {
149 149
             String[] proj = {MediaStore.Images.Media.DATA};
150 150
             cursor = context.getCurrentActivity().getContentResolver().query(selectedVideoUri, proj, null, null, null);
151
-            if (cursor == null) uploadFilePath = selectedVideoUri.getPath();
152
-            int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
153
-            cursor.moveToFirst();
154
-            uploadFilePath = cursor.getString(column_index);
151
+            if (cursor == null) {
152
+                uploadFilePath = selectedVideoUri.getPath();
153
+            } else {
154
+                int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
155
+                cursor.moveToFirst();
156
+                uploadFilePath = cursor.getString(column_index);
157
+            }
155 158
         } catch (Exception e) {
156 159
             uploadFilePath = FileUtils.getFilePathFromURI(context.getCurrentActivity(), selectedVideoUri);
157 160
         } finally {