Resolve #1082, #1081 again

This commit is contained in:
tarsin committed 2023-05-17 19:01:39 +08:00
1 parent 9af6532331
commit 47863580a0
1 file changed
+6 -2
@@ -876,8 +876,12 @@ class DownloadsScene :
private val height = (Settings.listThumbSize * 3).pxToDp.dp
fun bind(info: DownloadInfo) {
val downloadDir = SpiderDen.getGalleryDownloadDir(info.gid)?.takeIf { it.ensureDir() }
check(downloadDir != null)
val downloadDir = SpiderDen.getGalleryDownloadDir(info.gid) ?: run {
val title = EhUtils.getSuitableTitle(info)
val dirname = FileUtils.sanitizeFilename("${info.gid}-$title")
EhDB.putDownloadDirname(info.gid, dirname)
SpiderDen.getGalleryDownloadDir(info.gid)!!
}
val thumbLocation = downloadDir.subFile(".thumb")!!
val localReq = thumbLocation.takeIf { it.exists() }?.uri?.let {
context?.imageRequest {