sniff content type from extension when empty in response
This commit is contained in:
@@ -120,8 +120,8 @@ object MediaSaverToDisk {
|
|||||||
check(response.isSuccessful)
|
check(response.isSuccessful)
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
val contentType = response.header("Content-Type")
|
val contentType = response.header("Content-Type") ?: getMimeTypeFromExtension(url)
|
||||||
checkNotNull(contentType) { "Can't find out the content type" }
|
check(contentType.isNotBlank()) { "Can't find out the content type" }
|
||||||
|
|
||||||
val realType =
|
val realType =
|
||||||
if (contentType == "application/octet-stream") {
|
if (contentType == "application/octet-stream") {
|
||||||
|
|||||||
Reference in New Issue
Block a user