mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Add workarounds for missing MIME type information on API 16.
This commit is contained in:
@@ -34,6 +34,7 @@ class ImageHelperImpl implements ImageHelper {
|
||||
@Nullable
|
||||
@Override
|
||||
public String getExtensionFromMimeType(String mimeType) {
|
||||
if ("image/webp".equals(mimeType)) return "webp";
|
||||
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
|
||||
return mimeTypeMap.getExtensionFromMimeType(mimeType);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import static androidx.exifinterface.media.ExifInterface.TAG_ORIENTATION;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
|
||||
@NotNullByDefault
|
||||
class ImageSizeCalculatorImpl implements ImageSizeCalculator {
|
||||
@@ -61,6 +62,10 @@ class ImageSizeCalculatorImpl implements ImageSizeCalculator {
|
||||
logException(LOG, WARNING, e);
|
||||
}
|
||||
}
|
||||
if (!size.hasError() && isNullOrEmpty(size.getMimeType())) {
|
||||
LOG.info("Could not determine content type, using supplied type");
|
||||
size = new Size(size.getWidth(), size.getHeight(), contentType);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user