mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-11 19:00:49 +01:00
Fix #708
This commit is contained in:
parent
bc9417e16b
commit
bb9e230b35
1 changed files with 5 additions and 2 deletions
|
@ -16,8 +16,11 @@ import java.security.NoSuchAlgorithmException
|
||||||
object DiskUtil {
|
object DiskUtil {
|
||||||
|
|
||||||
fun isImage(name: String, openStream: (() -> InputStream)? = null): Boolean {
|
fun isImage(name: String, openStream: (() -> InputStream)? = null): Boolean {
|
||||||
val contentType = URLConnection.guessContentTypeFromName(name)
|
val contentType = try {
|
||||||
?: openStream?.let { findImageMime(it) }
|
URLConnection.guessContentTypeFromName(name)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
null
|
||||||
|
} ?: openStream?.let { findImageMime(it) }
|
||||||
|
|
||||||
return contentType?.startsWith("image/") ?: false
|
return contentType?.startsWith("image/") ?: false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue