Fix reader "Unable to edit key" error (#2634)

This commit is contained in:
AntsyLich
2025-11-01 15:03:51 +06:00
committed by GitHub
parent e9469451ac
commit aef3beb15f
2 changed files with 3 additions and 3 deletions

View File

@@ -6,7 +6,6 @@ import com.jakewharton.disklrucache.DiskLruCache
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.util.storage.DiskUtil
import eu.kanade.tachiyomi.util.storage.saveTo
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import logcat.LogPriority
import okhttp3.Response
@@ -115,7 +114,7 @@ class ChapterCache(
fun isImageInCache(imageUrl: String): Boolean {
return try {
diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)).use { it != null }
} catch (e: IOException) {
} catch (_: IOException) {
false
}
}
@@ -147,7 +146,7 @@ class ChapterCache(
try {
// Get editor from md5 key.
val key = DiskUtil.hashKeyForDisk(imageUrl)
editor = diskCache.edit(key) ?: throw IOException("Unable to edit key")
editor = diskCache.edit(key) ?: return
// Get OutputStream and write image with Okio.
response.body.source().saveTo(editor.newOutputStream(0))