Fix random page sent when manga is downloaded (#508)
This commit is contained in:
@@ -33,7 +33,6 @@ class ArchiveProvider(mangaId: Int, chapterId: Int) : DownloadedFilesProvider(ma
|
||||
val chapterFolder = File(chapterDir)
|
||||
if (outputFile.exists()) handleExistingCbzFile(outputFile, chapterFolder)
|
||||
|
||||
|
||||
FolderProvider(mangaId, chapterId).download(download, scope, step)
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
|
||||
@@ -24,7 +24,7 @@ class FolderProvider(mangaId: Int, chapterId: Int) : DownloadedFilesProvider(man
|
||||
val chapterDir = getChapterDownloadPath(mangaId, chapterId)
|
||||
val folder = File(chapterDir)
|
||||
folder.mkdirs()
|
||||
val file = folder.listFiles()?.get(index)
|
||||
val file = folder.listFiles()?.sortedBy { it.name }?.get(index)
|
||||
val fileType = file!!.name.substringAfterLast(".")
|
||||
return Pair(FileInputStream(file).buffered(), "image/$fileType")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user