Downloader: Don't trust index provided by source (#8122)

(cherry picked from commit 98c459a6b69a26338d310afe7f2629fa939d6f89)
This commit is contained in:
AntsyLich 2022-10-01 21:01:05 +06:00 committed by Jobobby04
parent c1df5adf2c
commit 30e3cc46c8

View File

@ -326,7 +326,9 @@ class Downloader(
if (pages.isEmpty()) { if (pages.isEmpty()) {
throw Exception(context.getString(R.string.page_list_empty_error)) throw Exception(context.getString(R.string.page_list_empty_error))
} }
download.pages = pages // Don't trust index from source
val reIndexedPages = pages.mapIndexed { index, page -> Page(index, page.url, page.imageUrl, page.uri) }
download.pages = reIndexedPages
} }
} else { } else {
// Or if the page list already exists, start from the file // Or if the page list already exists, start from the file