len 8 年之前
父節點
當前提交
bb9e230b35
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      app/src/main/java/eu/kanade/tachiyomi/util/DiskUtil.kt

+ 5 - 2
app/src/main/java/eu/kanade/tachiyomi/util/DiskUtil.kt

@@ -16,8 +16,11 @@ import java.security.NoSuchAlgorithmException
 object DiskUtil {
 
     fun isImage(name: String, openStream: (() -> InputStream)? = null): Boolean {
-        val contentType = URLConnection.guessContentTypeFromName(name)
-                ?: openStream?.let { findImageMime(it) }
+        val contentType = try {
+            URLConnection.guessContentTypeFromName(name)
+        } catch (e: Exception) {
+            null
+        } ?: openStream?.let { findImageMime(it) }
 
         return contentType?.startsWith("image/") ?: false
     }