Skip to content

Commit

Permalink
Log uri for guessContentTypeFromName exceptions
Browse files Browse the repository at this point in the history
Summary: Add additional logging around the exception to figure out what kind of uris are causing the exception for `getContentTypeForFileName`

Reviewed By: PeteTheHeat

Differential Revision: D14715917

fbshipit-source-id: 46299d2ff3f1f06991d7800784a025a85815ae8c
  • Loading branch information
Luna Wei authored and facebook-github-bot committed Apr 3, 2019
1 parent 15b2f99 commit d9711e2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,13 @@ private static boolean putImageInfo(
float width = media.getInt(widthIndex);
float height = media.getInt(heightIndex);

String mimeType = URLConnection.guessContentTypeFromName(photoUri.toString());
String mimeType;
try {
mimeType = URLConnection.guessContentTypeFromName(photoUri.toString());
} catch (StringIndexOutOfBoundsException e) {
FLog.e(ReactConstants.TAG, "Unable to guess content type from " + photoUri.toString(), e);
throw e;
}

if (mimeType != null
&& mimeType.startsWith("video")) {
Expand Down

0 comments on commit d9711e2

Please sign in to comment.