Fix thumb extension for webp

This commit is contained in:
Dude so hot authored and renovate[bot] committed 2024-10-30 19:08:52 +08:00
1 parent 4e145f46db
commit dacbf5edb3
2 files changed
+3 -2

No files matched your search

@@ -7,7 +7,6 @@ import coil3.request.ImageRequest
import coil3.request.ImageResult
import coil3.request.SuccessResult
import com.hippo.ehviewer.EhApplication.Companion.imageCache
import com.hippo.ehviewer.download.downloadLocation
import com.hippo.ehviewer.util.sendTo
import com.hippo.files.isDirectory
import com.hippo.files.isFile
@@ -14,8 +14,10 @@ import com.hippo.ehviewer.download.downloadLocation
fun ImageRequest.Builder.ehUrl(info: GalleryInfo) = apply {
val key = info.thumbKey!!
data(info.thumbUrl)
val format = info.thumbUrl.substringAfterLast('.', "")
check(format.isNotBlank())
if (info is DownloadInfo && !info.dirname.isNullOrBlank()) {
downloadLocation(downloadLocation / info.dirname / "thumb.jpg")
downloadLocation(downloadLocation / info.dirname / "thumb.$format")
}
memoryCacheKey(key)
diskCacheKey(key)