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) 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") {