sniff content type from extension when empty in response

This commit is contained in:
David Kaspar
2025-03-17 19:24:15 +00:00
parent 6fd5f36ff5
commit bcd636b46e
@@ -120,8 +120,8 @@ object MediaSaverToDisk {
check(response.isSuccessful)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val contentType = response.header("Content-Type")
checkNotNull(contentType) { "Can't find out the content type" }
val contentType = response.header("Content-Type") ?: getMimeTypeFromExtension(url)
check(contentType.isNotBlank()) { "Can't find out the content type" }
val realType =
if (contentType == "application/octet-stream") {