diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 1653fe0ef..3221168e7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -465,7 +465,7 @@ class Downloader( */ private fun getImageExtension(response: Response, file: UniFile): String { // Read content type if available. - val mime = response.body?.contentType()?.let { ct -> "${ct.type}/${ct.subtype}" } + val mime = response.body?.contentType()?.run { if (type == "image") "image/$subtype" else null } // Else guess from the uri. ?: context.contentResolver.getType(file.uri) // Else read magic numbers. diff --git a/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt b/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt index ff56520b5..72248f17b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/network/ProgressResponseBody.kt @@ -15,8 +15,8 @@ class ProgressResponseBody(private val responseBody: ResponseBody, private val p source(responseBody.source()).buffer() } - override fun contentType(): MediaType { - return responseBody.contentType()!! + override fun contentType(): MediaType? { + return responseBody.contentType() } override fun contentLength(): Long {