|
50 | 50 | import java.util.ArrayList;
|
51 | 51 | import java.util.List;
|
52 | 52 | import javax.annotation.Nullable;
|
53 |
| -import java.net.URLConnection; |
54 | 53 | import java.net.URL;
|
55 | 54 |
|
56 | 55 | // TODO #6015104: rename to something less iOSish
|
@@ -388,7 +387,8 @@ private static void putEdges(
|
388 | 387 | WritableMap edge = new WritableNativeMap();
|
389 | 388 | WritableMap node = new WritableNativeMap();
|
390 | 389 | boolean imageInfoSuccess =
|
391 |
| - putImageInfo(resolver, media, node, idIndex, widthIndex, heightIndex, dataIndex); |
| 390 | + putImageInfo(resolver, media, node, idIndex, widthIndex, heightIndex, dataIndex, |
| 391 | + mimeTypeIndex); |
392 | 392 | if (imageInfoSuccess) {
|
393 | 393 | putBasicNodeInfo(media, node, mimeTypeIndex, groupNameIndex, dateTakenIndex);
|
394 | 394 | putLocationInfo(media, node, longitudeIndex, latitudeIndex);
|
@@ -423,20 +423,15 @@ private static boolean putImageInfo(
|
423 | 423 | int idIndex,
|
424 | 424 | int widthIndex,
|
425 | 425 | int heightIndex,
|
426 |
| - int dataIndex) { |
| 426 | + int dataIndex, |
| 427 | + int mimeTypeIndex) { |
427 | 428 | WritableMap image = new WritableNativeMap();
|
428 | 429 | Uri photoUri = Uri.parse("file://" + media.getString(dataIndex));
|
429 | 430 | image.putString("uri", photoUri.toString());
|
430 | 431 | float width = media.getInt(widthIndex);
|
431 | 432 | float height = media.getInt(heightIndex);
|
432 | 433 |
|
433 |
| - String mimeType; |
434 |
| - try { |
435 |
| - mimeType = URLConnection.guessContentTypeFromName(photoUri.toString()); |
436 |
| - } catch (StringIndexOutOfBoundsException e) { |
437 |
| - FLog.e(ReactConstants.TAG, "Unable to guess content type from " + photoUri.toString(), e); |
438 |
| - throw e; |
439 |
| - } |
| 434 | + String mimeType = media.getString(mimeTypeIndex); |
440 | 435 |
|
441 | 436 | if (mimeType != null
|
442 | 437 | && mimeType.startsWith("video")) {
|
|
0 commit comments