diff --git a/app/src/main/kotlin/com/hippo/ehviewer/coil/DownloadThumbInterceptor.kt b/app/src/main/kotlin/com/hippo/ehviewer/coil/DownloadThumbInterceptor.kt index 813248f4b..acdacfe7a 100644 --- a/app/src/main/kotlin/com/hippo/ehviewer/coil/DownloadThumbInterceptor.kt +++ b/app/src/main/kotlin/com/hippo/ehviewer/coil/DownloadThumbInterceptor.kt @@ -12,12 +12,22 @@ import com.hippo.unifile.asUniFile import eu.kanade.tachiyomi.util.lang.withIOContext object DownloadThumbInterceptor : Interceptor { + // TODO: Remove this after a few releases + private const val LEGACY_THUMB_FILE = ".thumb" + private const val THUMB_FILE = "thumb.jpg" override suspend fun intercept(chain: Interceptor.Chain): ImageResult { val magicOrUrl = chain.request.data as? String if (magicOrUrl != null) { val (url, location) = decodeMagicRequestOrUrl(magicOrUrl) if (location != null) { - val thumb = withIOContext { downloadLocation / location / ".thumb" } + val thumb = withIOContext { + val legacyThumb = downloadLocation / location / LEGACY_THUMB_FILE + if (legacyThumb.isFile) { + legacyThumb.apply { renameTo(THUMB_FILE) } + } else { + downloadLocation / location / THUMB_FILE + } + } if (withIOContext { thumb.isFile }) { val new = chain.request.newBuilder().data(thumb.uri.toString()).build() when (val result = chain.withRequest(new).proceed()) {