Handle 1000+ pages properly in the downloader

Co-Authored-By: jobobby04 <17078382+jobobby04@users.noreply.github.com>
This commit is contained in:
Jays2Kings 2023-02-11 17:18:41 -05:00
parent 60ab0d2fa7
commit 9ba9a51f79

View file

@ -406,7 +406,9 @@ class Downloader(
return Observable.just(page)
}
val filename = String.format("%03d", page.number)
val digitCount = (download.pages?.size ?: 0).toString().length.coerceAtLeast(3)
val filename = String.format("%0${digitCount}d", page.number)
val tmpFile = tmpDir.findFile("$filename.tmp")
// Delete temp file if it exists.