Fixed avif/encrypted thumbnails not loading (#966)

* Fixed avif/encrypted thumbnails not loading

* used new input stream instead of byteArray
This commit is contained in:
Shamicen 2023-10-29 23:11:16 +01:00 committed by GitHub
parent bfe824af18
commit d502ebc275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,12 +62,14 @@ class TachiyomiImageDecoder(private val resources: ImageSource, private val opti
} }
private fun isApplicable(source: BufferedSource): Boolean { private fun isApplicable(source: BufferedSource): Boolean {
// SY --> val type = source.peek().inputStream().buffered().use { stream ->
val type = source.peek().inputStream().buffered().use { ImageUtil.findImageType(stream)
if (CbzCrypto.detectCoverImageArchive(it)) return true
// SY <--
ImageUtil.findImageType(it)
} }
// SY -->
source.peek().inputStream().use { stream ->
if (CbzCrypto.detectCoverImageArchive(stream)) return true
}
// SY <--
return when (type) { return when (type) {
ImageUtil.ImageType.AVIF, ImageUtil.ImageType.JXL -> true ImageUtil.ImageType.AVIF, ImageUtil.ImageType.JXL -> true
ImageUtil.ImageType.HEIF -> Build.VERSION.SDK_INT < Build.VERSION_CODES.O ImageUtil.ImageType.HEIF -> Build.VERSION.SDK_INT < Build.VERSION_CODES.O