mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Attempt to recover from encountering octet stream media.
This commit is contained in:
@@ -64,6 +64,7 @@ public class MediaUtil {
|
||||
public static final String LONG_TEXT = "text/x-signal-plain";
|
||||
public static final String VIEW_ONCE = "application/x-signal-view-once";
|
||||
public static final String UNKNOWN = "*/*";
|
||||
public static final String OCTET = "application/octet-stream";
|
||||
|
||||
public static SlideType getSlideTypeFromContentType(@NonNull String contentType) {
|
||||
if (isGif(contentType)) {
|
||||
@@ -111,7 +112,7 @@ public class MediaUtil {
|
||||
}
|
||||
|
||||
String type = context.getContentResolver().getType(uri);
|
||||
if (type == null) {
|
||||
if (type == null || isOctetStream(type)) {
|
||||
final String extension = MimeTypeMap.getFileExtensionFromUrl(uri.toString());
|
||||
type = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension.toLowerCase());
|
||||
}
|
||||
@@ -325,6 +326,10 @@ public class MediaUtil {
|
||||
return (null != contentType) && contentType.equals(VIEW_ONCE);
|
||||
}
|
||||
|
||||
public static boolean isOctetStream(@Nullable String contentType) {
|
||||
return OCTET.equals(contentType);
|
||||
}
|
||||
|
||||
public static boolean hasVideoThumbnail(@NonNull Context context, @Nullable Uri uri) {
|
||||
if (uri == null) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user