mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-12 17:08:59 -04:00
fixing .js broken file
This commit is contained in:
parent
16bd983831
commit
6bf0894742
@ -127,9 +127,15 @@ class ZimFileReader constructor(
|
|||||||
return loadContent(uri)
|
return loadContent(uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readMimeType(uri: String) = uri.filePath.let {
|
fun readMimeType(uri: String): String {
|
||||||
it.mimeType?.takeIf(String::isNotEmpty) ?: mimeTypeFromReader(it) ?: DEFAULT_MIME_TYPE
|
var mime = uri.filePath.mimeType?.takeIf(String::isNotEmpty) ?: mimeTypeFromReader(uri)
|
||||||
}.also { Log.d(TAG, "getting mimetype for $uri = $it") }
|
?: DEFAULT_MIME_TYPE
|
||||||
|
val content = getContentAndMimeType(uri)
|
||||||
|
if (content.second != mime) {
|
||||||
|
mime = content.second
|
||||||
|
}
|
||||||
|
return mime.also { Log.d(TAG, "getting mimetype for $uri = $it") }
|
||||||
|
}
|
||||||
|
|
||||||
private fun mimeTypeFromReader(it: String) =
|
private fun mimeTypeFromReader(it: String) =
|
||||||
// Truncate mime-type (everything after the first space and semi-colon(if exists)
|
// Truncate mime-type (everything after the first space and semi-colon(if exists)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user